Recursive ascent parser: Difference between revisions

Content deleted Content added
m expand one of the refs
Ruud Koot (talk | contribs)
Line 1:
In [[computingcomputer science]], '''recursive ascent parsing''' is a technique for implementing an [[LALR]] parser which uses mutually-recursive functions rather than tables. Thus, the parser is ''directly encoded'' in the host language similar to [[recursive descent]]. Direct encoding usually yields a parser which is faster than its table-driven equivalent<ref>{{cite web|title=Very fast LR parsing|author=Thomas J Penello|year=1986|url=http://portal.acm.org/citation.cfm?id=13310.13326}}</ref> for the same reason that compilation is faster than interpretation. It is also (nominally) possible to hand edit a recursive ascent parser, whereas a tabular implementation is nigh unreadable to the average human.
 
Recursive ascent was first described by Thomas Penello in his article {{cite web|title=Very fast LR parsing|url=http://portal.acm.org/citation.cfm?id=13310.13326}} in 1986. He was not intending to create a hand-editable implementation of an LR parser, but rather a maintainable and efficient parser implemented in [[assembly language]]. The technique was later expounded upon by G.H. Roberts<ref>{{cite web|title=Recursive ascent: an LR analog to recursive descent|year=1988|author=G.H. Roberts|url=http://portal.acm.org/citation.cfm?id=47907.47909}}</ref> in 1988 as well as in an article by Leermakers, Augusteijn, Kruseman Aretz<ref>{{cite web|title=A functional LR parser|author=Leermakers, Augusteijn, Kruseman Aretz|year=1992|url=http://portal.acm.org/citation.cfm?id=146986.146994}}</ref> in 1992 in the journal ''Theoretical Computer Science''. An extremely readable description of the technique was written by Morell and Middleton<ref>{{cite article|title=Recursive-ascent parsing|author=Larry Morell and David Middleton|year=2003|journal=Journal of Computing Sciences in Colleges|volume=18|issue=6|pages=186–201|url=http://portal.acm.org/citation.cfm?id=770849}}</ref> in 2003. A good exposition can also be found in a TOPLAS article by Sperber and Thiemann<ref>{{cite web|title=Generation of LR parsers by partial evaluation|author=Sperber and Thiemann|year=2000|url=http://portal.acm.org/citation.cfm?id=349219&dl=GUIDE&coll=GUIDE&CFID=56087236&CFTOKEN=74111863}}</ref>.