Content deleted Content added
No edit summary |
avoid unnec redirect, link scope |
||
(One intermediate revision by one other user not shown) | |||
Line 1:
In [[computer science]], '''recursive ascent parsing''' is a technique for implementing an [[LR 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 journal|title=Very fast LR parsing|author=Thomas J Penello|journal=ACM SIGPLAN Notices |year=1986|volume=21 |issue=7 |pages=145–151 |doi=10.1145/13310.13326
Recursive ascent was first described by Thomas Pennello in his article {{cite book|chapter=Very fast LR parsing| doi=10.1145/12276.13326 |chapter-url=http://portal.acm.org/citation.cfm?id=13310.13326| title=Proceedings of the 1986 SIGPLAN symposium on Compiler construction - SIGPLAN '86 | year=1986 | last1=Pennello | first1=Thomas J. | pages=145–151 | isbn=0897911970 | s2cid=17214407 }} 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 journal|title=Recursive ascent: an LR analog to recursive descent|year=1988|author=G.H. Roberts|journal=ACM SIGPLAN Notices |volume=23 |issue=8 |pages=23–29 |doi=10.1145/47907.47909 |s2cid=12740771
Recursive ascent has also been merged with recursive descent, yielding a technique known as [[recursive ascent/descent]]. This implementation technique is arguably easier to hand-edit due to the reduction in states and fact that some of these states are more intuitively top-down rather than bottom up. It can also yield some minimal performance improvements over conventional recursive ascent.<ref>{{cite web|title=ScalaBison Recursive Ascent-Descent Parser Generator|author1=John Boyland |author2=Daniel Spiewak |name-list-style=amp |year=2009|url=http://www.cs.uwm.edu/~boyland/papers/scala-bison.pdf|archive-url=https://web.archive.org/web/20090718161230/http://www.cs.uwm.edu/~boyland/papers/scala-bison.pdf|archive-date=2009-07-18|url-status=dead}}</ref>
Line 7:
== Summary ==
Intuitively, recursive ascent is a literal implementation of the [[LR parser|LR parsing]] concept. Each function in the parser represents a single LR [[Finite
* '''Shift''' - Encoded as a function call, effectively jumping to a new automaton state.
|