Advertisement

Recursive ascent-descent parsers

  • R. Nigel Horspool
Invited Papers
Part of the Lecture Notes in Computer Science book series (LNCS, volume 477)

Abstract

Non-backtracking recursive descent parsers are easy to create but suffer from the disadvantage that they are limited to the relatively small LL(κ) class of grammars. Recursive ascent parsers can be built for the much larger LR(κ) class of grammars, but they are likely be too large to be useful and manual insertion of semantic action code into the parsers would require considerable skill. A composite approach, dubbed ‘recursive ascent-descent parsing’ or XLC(1) parsing, and which is related to left-corner parsing, solves all the problems. The parser has two parts — a top-down part and a bottom-up part. Either or both parts may be implemented as a collection of recursive functions or by a table-driven parsing algorithm. When a table-driven implementation of the bottom-up part is used, any syntax error recovery scheme applicable to LR parsers can be employed. Small, fast, implementations of the parsers are possible.

Keywords

Production Rule Semantic Action Free Position Current Symbol Manual Insertion 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

References

  1. [1]
    Aho, A.V., Sethi, R., and Ullman, J.D. Compilers: Principles, Techniques and Tools. Addison-Wesley, Reading, MA (1985).Google Scholar
  2. [2]
    Aretz, F.E.J.K. On a Recursive Ascent Parser. Information Processing Letters, 29, 3 (Nov. 1988), pp. 201–206.Google Scholar
  3. [3]
    Barnard, D.T., and Cordy, J.R. SL Parses the LR Languages. Computer Languages 13, 2 (1988), pp. 65–74.Google Scholar
  4. [4]
    Chapman, N.P. LR Parsing: Theory and Practice. Cambridge University Press, Cambridge, U.K. (1987).Google Scholar
  5. [5]
    Demers, A.J. Generalized Left Corner Parsing. Proc. 4th Symposium on Principles of Programming Languages (1977), pp. 170–182.Google Scholar
  6. [6]
    Fischer, C.N., and LeBlanc R.J. Jr., Crafting A Compiler. Benjamin/Cummings, Menlo Park, CA (1988).Google Scholar
  7. [7]
    Purdom, P., and Brown, C.A. Semantic Routines and LR(k) Parsers. Acta Informatica, 14 (1980), pp. 299–315.Google Scholar
  8. [8]
    Roberts, G.H. Recursive Ascent: An LR Analog to Recursive Descent. ACM SIGPLAN Notices, 23, 8 (Aug. 1988), pp. 23–29.Google Scholar
  9. [9]
    Roberts, G.H. Another Note on Recursive Ascent. To appear in Information Processing Letters (1989).Google Scholar
  10. [10]
    Röhrich, J. Methods for the Automatic Construction of Error Correcting Parsers. Acta Informatica, 13,2 (1980), pp. 115–139.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1991

Authors and Affiliations

  • R. Nigel Horspool
    • 1
  1. 1.Departement of Computer ScienceUniversity of VictoriaVictoriaCanada

Personalised recommendations