Tomita-Style Generalised LR Parsers (original) (raw)
Related papers
Construction of efficient generalized LR parsers
Automata Implementation, 1998
We show how LR parsers for the analysis of arbitrary context free grammars can be derived from classical Earley's parsing algorithm. The result is a Generalized LR parsing algorithm working at complexity O(n^3) in the worst case, which is achieved by the use of dynamic programming to represent the non-deterministic evolution of the stack instead of graph-structured stack representations, as has often been the case in previous approaches. The algorithm behaves better in practical cases, achieving linear complexity on LR
Generation of LR parsers by partial evaluation
ACM Transactions on Programming Languages and Systems, 2000
The combination of modern programming languages and partial evaluation yields new approaches to old problems. In particular, the combination of functional programming and partial evaluation can turn a general parser into a parser generator. We use an inherently functional approach to implement general LR(k) parsers and specialize them with respect to the input grammars using offline partial evaluation. The functional specification of LR parsing yields a concise implementation of the algorithms themselves. Furthermore, we demonstrate the elegance of the functional approach by incorporating on-the-fly attribute evaluation for S-attributed grammars and two schemes for error recovery, which lend themselves to natural and elegant implementation. The parsers require only minor changes to achieve good specialization results. The generated parsers have production quality and match those produced by traditional parser generators in speed and compactness.
A New Approach to the Construction of Generalized LR Parsing Algorithms
We present a Generalized LR parsing algorithm for unrestricted context-free grammars working in complexity O(n 3 ). It differs from previous approaches in the use of dynamic programming techniques to cope with the non determinism, instead of a graph-structured stack. The steps for deriving our algorithm from classical Earley's parsing algorithm are shown.
Construction Methods of LR Parsers
1981
This paper presents five different LR parser generators and an error recovery method which is derived directly from the LR parser. The parsers presented include the original LR (1) parser defined by Knuth. The SLR(1) and LALR(1) parsers defined by DeRemer, and the weak and strong compatible LR parsers presented by Pager. All five parsers have been implemented by the author using two programs. Furthermore, the implementation of the SLR (1) parser generator includes an error recovery method and produces an SLR(1) parser with error recovery built in.
Generalized LR parsing for extensions of context-free grammars
Current Issues in Linguistic Theory, 2000
We present a Generalized LR parsing algorithm for extensions of context-free grammars. It di ers from previous approaches in the use of dynamic programming techniques to cope with non determinism, instead of a graph-structured stack. The steps for deriving the algorithm from the classical Earley's parsing algorithm are shown.
Book Reviews: Generalized LR Parsing
1992
Tomita's algorithm, also called the Generalized LR (GLR) parser, is a method for natural language parsing that extends standard parsing techniques for LR(k) grammars to cases of nondeterminism (see Tomita 1986). This algorithm has became quite popular within the computational linguistics community. At the first International Workshop on Parsing Technologies, held in Pittsburgh in 1989, several papers were presented reporting experimental work and theoretical results based upon Tomita's algorithm.
Electronic Notes in Theoretical Computer Science
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.
Abstract LDTA’04 Preliminary Version Parameterized LR Parsing
2008
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 Schem...
An alternative approach to the improvement of LR(k) parsers
Acta Informatica, 1976
Korenjak are shown to be based on a single concept--that of modifying the contextual information on which parsing decisions axe made. This concept is then used to derive a straightforward algorithm for eliminating unit productions from an LR parser.