Recursive ascent parser: Difference between revisions

Content deleted Content added
performant is proscribed jargon
SmackBot (talk | contribs)
m Standard headings/general fixes
Line 17:
== Example ==
 
Consider the following grammar in [[GNU Bison | bison]] syntax:
 
<pre>expr : expr '+' term { $$ = $1 + $3; }
Line 32:
;</pre>
 
This grammar is [[LR parsing#A note about LR(0) versus SLR and LALR parsing | LR(0)]] in that it is left-recursive (in the '''expr''' non-terminal) but does not require any lookahead. Recursive ascent is also capable of handling grammars which are LALR(1) in much the same way that table-driven parsers handle such cases (by pre-computing conflict resolutions based on possible lookahead).
 
The following is a [[Scala (programming language) | Scala]] implementation of a recursive ascent parser based on the above grammar:
 
<pre>object ExprParser {
Line 310:
}</pre>
 
== See Also also==
 
* [[Recursive descent parser]]