Content deleted Content added
sort |
m Remove stray comma. |
||
Line 50:
What follows is an implementation of a recursive descent parser for the above language in [[C (programming language)|C]]. The parser reads in source code, and exits with an error message if the code fails to parse, exiting silently if the code parses correctly.
Notice how closely the predictive parser below mirrors the grammar above. There is a procedure for each nonterminal in the grammar. Parsing descends in a top-down manner
The implementations of the functions ''nextsym'' and ''error'' are omitted for simplicity.
|