skip to main content
research-article

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

Published: 14 March 2011 Publication History

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.
[2]
DeRemer, F., "Practical Translators for LR(k) Languages," Ph.D. Dissertation, Dept. of Electrical Engineering, MIT, 1969.
[3]
DeRemer, F. and Penello, T., "Efficient Computation of LALR(1) Look-Ahead Sets," ACM TOPLAS, V4, #4, pp. 615--649, 1982.
[4]
DeRemer, F., and Pennello, T., "The MetaWareTM TWS User's Manual," MetaWare, 412 Liberty St., Santa Cruz, Calif., 1981.
[5]
Johnson, S. {1975}. "Yacc: Yet Another Compiler Compiler." Computing Science Technical Report, No. 32, Bell Laboratories, Murray Hill, New Jersey.
[6]
Knuth, D. "On the Translation of Languages from Left to Right," Information and Control, V8, pp. 607--639, 1965.
[7]
Martin, D., "Brief Notes on SLR(1) Grammars and Parsing," UCLA Computer Science Department, internal report, 1974.
[8]
Martin, D. "The UCLA SLR(1) and LL(1) Grammar Analysis Programs," UCLA Computer Science Department, internal report, 1975.
[9]
O'Hair, K., "The LR System User Manual," LCSD-31B Rev.1 Draft, Lawrence Livermore National Laboratory, 1985.
[10]
Pager, D., "A Solution to an Open Question by Knuth," Information and Control, v17, #5, pp. 462--473, 1970.
[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).

Cited By

View all
  • (2024)Total Type Error Localization and Recovery with HolesProceedings of the ACM on Programming Languages10.1145/36329108:POPL(2041-2068)Online publication date: 5-Jan-2024

Index Terms

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

      Recommendations

      Comments

      Information & Contributors

      Information

      Published In

      cover image ACM SIGSOFT Software Engineering Notes
      ACM SIGSOFT Software Engineering Notes  Volume 36, Issue 2
      March 2011
      116 pages
      ISSN:0163-5948
      DOI:10.1145/1943371
      Issue’s Table of Contents

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      Published: 14 March 2011
      Published in SIGSOFT Volume 36, Issue 2

      Check for updates

      Author Tags

      1. LR(1)
      2. error recovery
      3. generic tokens
      4. oracles
      5. pager
      6. parser construction
      7. parsing

      Qualifiers

      • Research-article

      Contributors

      Other Metrics

      Bibliometrics & Citations

      Bibliometrics

      Article Metrics

      • Downloads (Last 12 months)8
      • Downloads (Last 6 weeks)0
      Reflects downloads up to 07 Mar 2025

      Other Metrics

      Citations

      Cited By

      View all
      • (2024)Total Type Error Localization and Recovery with HolesProceedings of the ACM on Programming Languages10.1145/36329108:POPL(2041-2068)Online publication date: 5-Jan-2024

      View Options

      Login options

      View options

      PDF

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader

      Figures

      Tables

      Media

      Share

      Share

      Share this Publication link

      Share on social media