On directly constructing LR(k) parsers without chain reductions

  • Authors:
  • Wilf R. LaLonde

  • Affiliations:
  • -

  • Venue:
  • POPL '76 Proceedings of the 3rd ACM SIGACT-SIGPLAN symposium on Principles on programming languages
  • Year:
  • 1976

Quantified Score

Hi-index 0.00

Visualization

Abstract

A chain production is a production of the form A→M where A is a nonterminal and M is either a terminal or nonterminal. Pager in [Pag5] has presented an algorithm which removes all chain reductions from LR(1) parsers after they have been constructed. In this paper, we present an algorithm for directly constructing LR(k) parsers with arbitrary subsets of the chain productions, called the useless chain productions, optimized out. If this subset is empty, the algorithm is a standard one [And 1, Kn]. If this subset consists of all chain productions, the result is a parser with all chain reductions optimized away. The algorithm, as in [Pag5], also eliminates from the parsers all nonterminals which occur as the left part of useless chain productions. This latter optimization along with the chain reduction optimization significantly decreases the storage space and execution times of the parsers. This provides an efficient solution of the open problem posed by Aho and Ullman [A&U2] for all LR(k) grammars.