Lukas Renggli, Stéphane Ducasse, Tudor Gîrba, Oscar Nierstrasz. Practical Dynamic Grammars for Dynamic Languages. In 4th Workshop on Dynamic Languages and Applications (DYLA 2010). Malaga, Spain, jun 2010.
Grammars for programming languages are traditionally specified statically. They are hard to compose and reuse due to ambiguities that inevitably arise. PetitParser combines ideas from scannerless parsing, parser combinators, parsing expression grammars and packrat parsers to model grammars and parsers as objects that can be reconfigured dynamically. Through examples and benchmarks we demonstrate that dynamic grammars are not only flexible but highly practical.