Parameterized LR Parsing

https://doi.org/10.1016/j.entcs.2004.06.007Get rights and content
Under a Creative Commons license
open access

Abstract

Common LR parser generators lack abstraction facilities for defining recurring patterns of productions. Although there are generators capable of supporting regular expressions on the right hand side of productions, no generator supports user defined patterns in grammars.

Parameterized LR parsing extends standard LR parsing technology by admitting grammars with parameterized non-terminal symbols. A generator can implement such a grammar in two ways, either by expansion or directly. We develop the theory required for the direct implementation and show that it leads to significantly smaller parse tables and that it has fewer parsing conflicts than the expanded grammar. Attribute evaluation for a parameterized non-terminal is possible in the same way as before, if the semantic functions related to the non-terminal are polymorphic with respect to the parameter.

We have implemented parameterized LR parsing in the context of Essence, a partial-evaluation based LR parser generator for Scheme.

Keywords

LR parser generator
productions
attribute evaluation
polymorphism
partial evaluation

Cited by (0)