Any book recommendation for writing a compiler?

Eugene Wissner belka at caraus.de
Sat Nov 4 22:08:41 UTC 2017


On Wednesday, 1 November 2017 at 20:53:44 UTC, Dr. Assembly wrote:
> Hey guys, if I were to get into dmd's source code to play a 
> little bit (just for fun, no commercial use at all), which 
> books/resources do you recommend to start out?

A few more resources on writing a frontend (lexer, syntactic and 
semantic analizer).

http://thinkingeek.com/gcc-tiny/
Tells how to create a GCC frontend for a Pascal-like language, 
tiny. Can be useful since you can look how it applies to a real 
dfrontend in GDC.

https://ruslanspivak.com/lsbasi-part1/
Very clear tutorial on writing a Pascal interpreter in Python. 
Very beginner friendly, but not complete yet.

http://buildyourownlisp.com/contents
It is an online book that teaches C by writing an interpreter for 
a Lisp-like language, lispy. The code can be easely translated to 
D.

If you want you can also look at some haskell books. A simple 
parser is one of the standard projects used to teach haskell.


More information about the Digitalmars-d-learn mailing list