views:

348

answers:

4

I'm wanting to play around with creating an LR parser generators. Does anyone know of a good (free) resource describing how to create a state machine table from a grammar?

+3  A: 

For a free resource, consider the Python source code for PLY - a full implementation of Lex and Yacc in Python.

I would recommend a book, however, and you can hardly do better than get The Dragon Book.

Eli Bendersky
I really should just break down and buy a copy (and looking at the used prices I might just do that) but I'm often to stingy. Besides, it's sort of a sacrilege to spend money on "totally useless but cool code hacks"
BCS
Absolutely not "totally useless". Reading the dragon book can teach you a lot about programming. Armed with a good understanding of LR parsers you'll be better able to grasp new languages and design others, such as DSLs for specific tasks.
Eli Bendersky
I've already written a parser generator (recursive descent) and played with languages on a number of projects. The "totally useless" part is that fact that the implementation language is going to be MySQL!
BCS
I've ordered a copy.
BCS
+2  A: 

The best resource I have come across is:

Parsing Techniques - A Practical Guide

leppie
Looks like it's out of print :(. If I see a copy I'll take a look.
BCS
There's a first edition available as a PDF from that website. It doesn't get close to the Dragon, though.
Eli Bendersky
A: 

Maybe you find Grammatica useful. It's a free Parser generator for .NET. I have some experience with it and it was good. You can try it and study its code. http://grammatica.percederberg.net/

Rafa G. Argente
+1  A: 

The obvious answer is the standard compiler text by Aho/Ullman/Ravi, Compilers: Principles, Techniques, and Tools

It has complete chapters on parsing. It isn't free, but it is worth every last penny, and if you are going to build parsers or other compiler-like tools, you are simply crazy if you don't have this book.

Ira Baxter