Hacker News new | past | comments | ask | show | jobs | submit login
Create your own programming language in JavaScript (nathansuniversity.appspot.com)
177 points by fogus on March 26, 2012 | hide | past | favorite | 27 comments



I ran through something like this a couple of years ago and found it to be one of the most entertaining side projects I had worked on in a long while.

Scheme from Scratch - http://peter.michaux.ca/articles/scheme-from-scratch-introdu...


I admired (and still do) your posts very much. Thank you for them.


As a note, I just followed along with Peter, using his posts to get a handle on scheme. Mine was https://github.com/arlaneenalra/Bootstrap-Scheme


I love the idea of offering your own mini-course. Teaching is by far the fastest way of cementing your knowledge of a subject. It would be great if someone could create a platform /'app store' for providing stuff like this, free or otherwise.


The guys from Envato just released a tutorial marketplace:

http://marketplace.tutsplus.com/


I believe Udemy.com does very similar to this and has a wide variety of courses.


That's very cool, thanks. I'd heard the name before, but never checked it out.


This is also starting in 3 weeks: http://www.udacity.com/overview/Course/cs262


Thats learning about different programming languages... Not creating your own.


Check the syllabus; you create a Javascript/HTML parser and learn about syntax trees, grammars, etc. So the content will be similar to creating your own programming language.


Both of these are basically introductory Programming Languages classes (with a capital P and L, in other words the study of programming languages themselves). I'm not really sure how you could create your own language without learning about different languages.


Are there any other good tutorials on creating a toy programming language? Something that teaches about lexers, parsers, etc.


These are my favorite resources:

Compiler Construction: http://www.ethoberon.ethz.ch/WirthPubl/CBEAll.pdf

The Elements of Computing Systems: http://amzn.to/GQycqj

MetaCompilers: http://www.bayfronttechnologies.com/mc_tutorial.html

How to Create Your Own Freaking Awesome Programming Language: http://createyourproglang.com/

Bootstrapping a simple compiler from nothing: http://www.rano.org/bcompiler.html


My (pricey) favourite is Lisp In Small Pieces: http://www.amazon.com/Lisp-Small-Pieces-Christian-Queinnec/d...

Note that Peter Norvig gives it a five-star review.

(The affiliate link benefits DuckDuckGo.)


Correct me if I'm wrong, but wasn't "How to Create Your Own Freaking Awesome Programming Language" the motivation for CoffeeScript. That alone should be enough motivation for sending your money that way.


You're correct. That's why the first version was written in Ruby :)


To add to the list, Peter Norwig's lisp interpreter is a short, concise introduction to interpreters.

http://norvig.com/lispy.html

http://norvig.com/lispy2.html


Another one I recommend, because it starts with codegen and works its way back:

Writing a compiler in Ruby, bottom up: http://www.hokstad.com/compiler


You must read JonesForth, a literate program which starts from x86 assembly and builds up a complete Forth environment:

https://github.com/chengchangwu/jonesforth


Check out Andrej Bauer's Programming language Zoo for some simple languages implemented in OCaml. Although he focuses more on the implementation/runtime semantics than on syntax.

http://andrej.com/plzoo/


I like his teaching style. To get a sense for yourself check out http://nathansjslessons.appspot.com where he covers functions as values, closures, and CSP in javascript.

I dunno about you guys but I seem to spend almost all my professional time programming in javascript these days. This is perfect!


i created a programming language of sorts in javascript, it was awful to code in (stored code as strings and used eval to run everything), but it did work - it is used for creating macros on an in-house billing system and only worked under ie6 trusted (which was the mandated browser) - more modern browsers balked at the cross site scripting exploit it took advantage of, but it was pretty useful way to deploy batch scripts as a bookmark. will share if anyone dares!


You can also just fork one of the many that are out there. Makes it easier than starting from scratch (although I realize for some people that eliminates the fun part). I'm liking Sibilant a lot: http://sibilantjs.info


Why redirect from nathansuniversity.com to nathansuniversity.appspot.com? Shouldn't it be the other way around?


He might think he'll get a lot of traffic, so google's servers would help.


Why build a programming language in a language other then Lisp?


I bet he will be building some RPN language ... which is a rather boring task.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: