Hacker News new | ask | show | jobs
by aoe 5192 days ago
Are there any other good tutorials on creating a toy programming language? Something that teaches about lexers, parsers, etc.
3 comments

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/