skip to main content
research-article

LR(1) parser generation system: LR(1) error recovery, oracles, and generic tokens

Published:14 March 2011Publication History
Skip Abstract Section

Abstract

The LR(1) Parser Generation System generates full LR(1) parsers that are comparable in speed and size to those generated by LALR(1) parser generators, such as yacc [5]. In addition to the inherent advantages of full LR(1) parsing, it contains a number of novel features. This paper discusses three of them in detail: an LR(1) grammar specified automatic error recovery algorithm, oracles, and generic tokens.

The error recovery algorithm depends on the fact that full LR(1) parse tables preserve context. Oracles are pieces of code that are defined in a grammar and that are executed between the scanner and parser. They are used to resolve token ambiguities, including semantic ones. Generic tokens are used to replace syntactically identical tokens with a single token, which is, in effect, a variable representing a set of tokens.

References

  1. DeRemer, F., "Simple LR(k) Grammars," CACM, v14, #7, pp. 453--460, July, 1971. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. DeRemer, F., "Practical Translators for LR(k) Languages," Ph.D. Dissertation, Dept. of Electrical Engineering, MIT, 1969.Google ScholarGoogle Scholar
  3. DeRemer, F. and Penello, T., "Efficient Computation of LALR(1) Look-Ahead Sets," ACM TOPLAS, V4, #4, pp. 615--649, 1982. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. DeRemer, F., and Pennello, T., "The MetaWareTM TWS User's Manual," MetaWare, 412 Liberty St., Santa Cruz, Calif., 1981.Google ScholarGoogle Scholar
  5. Johnson, S.. {1975}. "Yacc: Yet Another Compiler Compiler." Computing Science Technical Report, No. 32, Bell Laboratories, Murray Hill, New Jersey.Google ScholarGoogle Scholar
  6. Knuth, D. "On the Translation of Languages from Left to Right," Information and Control, V8, pp. 607--639, 1965.Google ScholarGoogle ScholarCross RefCross Ref
  7. Martin, D., "Brief Notes on SLR(1) Grammars and Parsing," UCLA Computer Science Department, internal report, 1974.Google ScholarGoogle Scholar
  8. Martin, D. "The UCLA SLR(1) and LL(1) Grammar Analysis Programs," UCLA Computer Science Department, internal report, 1975.Google ScholarGoogle Scholar
  9. O'Hair, K., "The LR System User Manual," LCSD-31B Rev.1 Draft, Lawrence Livermore National Laboratory, 1985.Google ScholarGoogle Scholar
  10. Pager, D., "A Solution to an Open Question by Knuth," Information and Control, v17, #5, pp. 462--473, 1970.Google ScholarGoogle ScholarCross RefCross Ref
  11. Wetherell, C. & Shannon, A., "LR Automatic Parser Generator System and LR(1) Parser," UCRL-87926, Lawrence Livermore National Laboratory, July 14, 1979 (also IEEE Transactions on Software Engineering, v7, #3., pp. 274--278, 1981). Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. LR(1) parser generation system: LR(1) error recovery, oracles, and generic tokens

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader