Recursive descent parser generator

From Rosetta Code
Revision as of 05:46, 2 April 2014 by rosettacode>MagiMaster (Adding this as a very rough draft. Still needs a lot of specification before any examples can be added.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 input in the following format 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.)

Input format:

var [a-z]+

...

The first section contains the token definitions. Each line contains the name of a token followed by a regular expression. Tokens are to be matched greedily in the order given. The token section ends with a blank line.

The second section contains the production rules. Each rule consists of a non-terminal symbol and [more work needs to be done on this part of the task]. 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