Recursive descent parser generator
Recursive descent parser generator is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
Write a recursive descent parser generator that takes a description of a grammar as input and outputs the source code for a parser in the same language as the generator. (So a generator written in C++ would output C++ source code for the parser.) You can assume that all of the rules have been preprocessed into a form suitable for the construction of a recursive descent parser. See here for more details: http://www.cs.engr.uky.edu/~lewis/essays/compilers/rec-des.html
Example grammar:
plus \+ times \* var [a-z]+ !! start -> expr start2 !! start2 -> plus start2 !! start2 -> expr !! expr -> var expr2 !! expr2 -> times expr2 !! expr2 -> var
Use the parser generator to build a parser that takes arithmetic expressions and turns them in to three address code. The resulting parser should take this (or something similar) as input:
(one + two) * three - four * five 123 + 321
And generate this (or something similar) as output:
_0001 = one + two _0002 = _0001 * three _0003 = four * five _0004 = _0002 - _0003 _0005 = 123 + 321