Frankenstella, a PHP compiler
Friday, September 03, 2004
Parser Generators - For Posterity and all that
Firstly, it must be said that there is no substitute for the Dragon Book. Having said that, reading the Dragon Book cover to cover is no way to go either. It helps to try out stuff at a Black Box level rather than delve into the mechanics of, say Lex & Yacc.
What follows would only be helpful after one has at least Chapter 2 Knowledge of the Dragon Book.
The Free Compiler Construction Tools gives a one stop shop for all your opensource, and free parser generators.
ANTLER is probably the most widely used Parser Generator, and is an improvement over the lexx/yacc combo in 2 ways
1. It uses EBNF style grammars
2. The code generated is more intuitive and understandable. The messy numeric states given by lex/yacc are thankfully missing.
The Antlr link given above point to some pretty nifty resources as well.
This article gives a discussion on parser generators that is heavily, biased towards ANTLR, but gives good insight into the playing field.
This article on Compiler Front End and Infrastructure Software gives a rundown on infrastructures aimed at research applications as well as commercial compiler construction toolkits.
incidentally, ANTLR is a second generation compiler toolkit evolving from the older PCCTS
The techniques used in the Parser can be demystified somewhat by using Visual YACC.
For those who want to experiment with the Grandfather of all toolkits, A Compact Guide to Lex & Yacc is the way to go.
That's a distillation of the links that would give you an overall idea of what is out there in terms of compiler toolkits.But all this is relevant only to the front end of a compiler. The back end code generation is much more difficult to get at, though it is less complicated. But that will follow later.
