Genturfa'i

From OpenCog
Jump to: navigation, search

Template:ChickenSchemeEgg Template:Wikipedia

genturfa'i is a Chicken Scheme egg that compiles a Parsing Expression Grammar to Scheme, creating a Packrat Parser for a particular grammar.

A packrat parser is a recursive descent parser with unlimited lookahead, which runs in linear time due to memoization of intermediate results.

genturfa'i is part of OpenCog's Lojban Framework, where it compile's Lojban's PEG grammar to Scheme and provides runtime support (in the form of packrat parsing.) for parsing a Lojban utterance into an abstract syntax tree.

If you are not interested in writing new Parsing Expression Grammars, this program can be considered identical to jbogenturfa'i.

History

genturfa'i was written in 2011 to compile Lojban's PEG grammar. That grammar is possibly the largest and most complex PEG grammar to have been written, and many existing Packrat parsers would produce incorrect parse trees when parsing Lojban.

It was (is?) the only PEG to Scheme compiler, with prior implementations in Scheme requiring the PEG to be manually translated to Scheme.

See Also