←back to thread

429 points rui314 | 1 comments | | HN request time: 0.318s | source
Show context
peterkelly ◴[] No.10732090[source]
For anyone interested in compiler writing and looking for a good resource to start, probably one of the best is the "Dragon Book":

http://www.amazon.com/Compilers-Principles-Techniques-Tools-...

I highly recommend it, but it's heavy stuff. There are probably simpler guides out there that just cover the basics.

replies(6): >>10732136 #>>10732162 #>>10732256 #>>10732890 #>>10733017 #>>10742248 #
sklogic ◴[] No.10732162[source]
Please stop recommending the Dragon Book already. It is not just heavy, it is mostly outdated and irrelevant.
replies(7): >>10732214 #>>10732311 #>>10732417 #>>10732559 #>>10732828 #>>10733072 #>>10733258 #
barrkel ◴[] No.10732311[source]
It's fairly heavy in lexing and parsing theory, especially around finite automata, pushdown automata, etc. It's the kind of book you might want to read if you're reimplementing yacc.

Modern code generation has moved on a bit, so I wouldn't dig too deeply into the latter third or so of the book.

All in all, for a hobby compiler, it would be a poor choice; heavy on unnecessary theory in the front end and outdated on on back end stuff.

Let's Build a Compiler by Jack Crenshaw is one of my favourite guides for the hobbyist, although it's a bit dated now since it used Turbo Pascal and targeted 16-bit x86.

replies(1): >>10732885 #
sklogic ◴[] No.10732885[source]
It does not make any sense to reimplement yacc in the 21st century. There are far more powerful and yet simple parsing techniques, rendering all that automata stuff useless and outdated. Take a look at PEG, Pratt parsing and GLR.
replies(2): >>10733238 #>>10733267 #
wtetzner ◴[] No.10733267[source]
Or even better, GLL.

http://dotat.at/tmp/gll.pdf

replies(2): >>10735271 #>>10735314 #
1. nickpsecurity ◴[] No.10735271[source]
Best features of both types of parsers? Hell yeah! Never even heard of this one despite all the research updates I did a few years ago. Thanks for the link.