It seems that parsing is a hard subject to learn. I was wondering what would be recommended as the very easiest books on the subject. The most basic, beginner, easiest books on parsing. Is there no parsing for dummies?
views:
243answers:
4Dragon Book is definitely not the easiest.
Yes. Its not the easiest. But then compiler design is also not easy.
Its the standard & most recommended book for Compiler Design
in colleges.
Few books cover just parsing, divorced from all other tasks that relate to developing compilers, but there are some -- out of the few I'd recommend this one, which has the substantial advantage that you can freely download the PDF for the first edition. (The second edition, which is for sale and I have not seen, appears to offer, as additions, mostly pretty advanced stuff and very updated surveys of very advanced academic literature -- probably stuff you don't really need as a beginner).
The most commonly used parsing methods applicable to parsing data files and programming languages can be divided into two groups: top-down and bottom-up. For beginners, the top-down method also known as recursive descent parsing is generally easier to understand, so I would recommend you start with that.
The most hands on text for recursive descent parsing (and compiling) is Jack Crenshaw's online book/tutorial "Let's write a compiler". You can find it here:
The exercises/examples are written in Turbo-Pascal. You can use the free FreePascal compiler to compile and run them. You can find it at:
Once you have worked through Jack Crenshaw's text, I'd recommend the following book for it is very easy to read and hands-on as well:
- Brinch Hansen on Pascal compilers, ISBN 0130830984
There is also Wirth's book "Compiler Construction" which is now freely available as a PDF from ETHZ's website at:
The PDF is a revised version of the 1996 edition which uses Oberon (a descendant of Pascal and Modula-2). Free compilers for Oberon are listed on DMOZ at: