(Stolen from http://www.scifac.ru.ac.za/coco/)
Coco/R combines the functionality of the well-known UNIX tools lex and yacc , to form an extremely easy to use compiler generator that generates recursive descent parsers, their associated scanners, and (in some versions) a driver program, from attributed grammars (written using EBNF syntax with attributes and semantic actions) which conform to the restrictions imposed by LL(1) parsing (rather than LALR parsing, as allowed by yacc ). The user has to add modules for symbol table handling, optimization, and code generation in order to get a running compiler. Coco/R can also be used to construct other syntax-based applications that have less of a “compiler” flavour.
Coco/R(uby) is a port of Coco/R to ruby and generates pure ruby parsers and scanners. This version of Coco/R is not related to Mark Probert’s version (http://raa.ruby-lang.org/list.rhtml?name=coco-rb).
This version of Coco/R generates pure ruby. Mark’s version generates C for ruby extensions. If you find this version too slow, you might want to check out Mark’s. If however, you need pure ruby or can’t deploy where there is a C compiler, you finally have an LL solution.
gem install cocorIf you want to hack on cocor, clone it from GitHub:
git clone git://github.com/seattlerb/cocor