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.
- DeRemer, F., "Simple LR(k) Grammars," CACM, v14, #7, pp. 453--460, July, 1971. Google ScholarDigital Library
- DeRemer, F., "Practical Translators for LR(k) Languages," Ph.D. Dissertation, Dept. of Electrical Engineering, MIT, 1969.Google Scholar
- DeRemer, F. and Penello, T., "Efficient Computation of LALR(1) Look-Ahead Sets," ACM TOPLAS, V4, #4, pp. 615--649, 1982. Google ScholarDigital Library
- DeRemer, F., and Pennello, T., "The MetaWareTM TWS User's Manual," MetaWare, 412 Liberty St., Santa Cruz, Calif., 1981.Google Scholar
- Johnson, S.. {1975}. "Yacc: Yet Another Compiler Compiler." Computing Science Technical Report, No. 32, Bell Laboratories, Murray Hill, New Jersey.Google Scholar
- Knuth, D. "On the Translation of Languages from Left to Right," Information and Control, V8, pp. 607--639, 1965.Google ScholarCross Ref
- Martin, D., "Brief Notes on SLR(1) Grammars and Parsing," UCLA Computer Science Department, internal report, 1974.Google Scholar
- Martin, D. "The UCLA SLR(1) and LL(1) Grammar Analysis Programs," UCLA Computer Science Department, internal report, 1975.Google Scholar
- O'Hair, K., "The LR System User Manual," LCSD-31B Rev.1 Draft, Lawrence Livermore National Laboratory, 1985.Google Scholar
- Pager, D., "A Solution to an Open Question by Knuth," Information and Control, v17, #5, pp. 462--473, 1970.Google ScholarCross Ref
- 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 ScholarDigital Library
Index Terms
- LR(1) parser generation system: LR(1) error recovery, oracles, and generic tokens
Recommendations
Full LR(1) parser generator Hyacc and study on the performance of LR(1) algorithms
C3S2E '11: Proceedings of The Fourth International C* Conference on Computer Science and Software EngineeringDespite the popularity of LALR(1) parser generators such as Yacc/Bison and LL parser generators such as ANTLR, robust and effective LR(1) parser generators are rare due to expensive performance and implementation difficulty. This work employed relevant ...
Regular right part grammars and their parsers
This paper introduces an alternative to context-free grammars called regular right part (RRP) grammars, which resemble PASCAL syntax diagrams. Formally, RRP grammars have production right parts, which are nondeterministic finite state machines (FSMs), ...
LR Automatic Parser Generator and LR(1) Parser
LR is an LR(1) parser generation system. It is written entirely in portable ANS1 standard Fortran 66 and has been successfully operated on a number of computers. LR uses a powerful algorithm of Pager's to generate a space efficient parser for any LR(1) ...
Comments