On Jun 21, 2008, at 09:58 , nicholasmabry / gmail.com wrote:

>> I'm looking for documentation on rex & racc, as what I have found  
>> up to now
>> (mainly the homepages and the READMEs) are rather terse.
>
> I haven't run across any rex and racc tutorials online, but there are
> is a solid example parser buried inside the rex tarball distribution.
> The 'calc3' example consists of two source files:
> calc3.rex  -> The rex token definitions
> calc3.racc -> The racc grammar definitions and executable script
>
> They demonstrate many of the differences in coming from lex and yacc.
>
> If you aren't familiar with the traditionally C-based lex and yacc,
> they have been in wide use for a (relatively) long time and are well
> documented online. I would suggest starting with their documentation
> if you are just getting started with parsers, or even LALR parsers. A
> good introduction can be found here:
> http://epaperpress.com/lexandyacc/
>
> If you aren't set on using an LALR parser, then the Treetop library is
> an interesting alternative. It uses a very different method of
> generation, but it's become a popular Ruby tool. It can be found here:
> http://treetop.rubyforge.org/
>
> Let us know if this doesn't answer your question. Good luck!

This is all good advice. For a more complicated racc example (doesn't  
use rex), look at ruby_parser. It is big and gross, so it better  
simulates what all yacc-based grammar definitions eventually become. :)