Rheinische Friedrich-Wilhelms-Universität Bonn Institut für Informatik
Abteilung V

Universität Bonn -> Institut für Informatik -> Abteilung V
CS-Reports 2010 Copyright 2010 Universität Bonn, Institut für Informatik, Abt. V


On LR(k)-parsers of polynomial size
Norbert Blum
[Download PostScript] [Download PDF]

Usually, a parser for an LR(k)-grammar G is a deterministic pushdown transducer which produces backwards the unique rightmost derivation for a given input string x ∈ L(G). The best known upper bound for the size of such a parser is O(2|G||Σ|k+1 ) where |G| and |Σ| are the size of the grammar G and the terminal alphabet Σ, respectively. If we add to a parser the possibility to manipulate a directed graph of size O(|G|n) where n is the length of the input then we obtain an extended parser. The graph is used for an efficient parallel simulation of all potential leftmost derivations of the current right sentential form such that the unique rightmost derivation of the input can be computed. Given an arbitrary LR(k)-grammar G, we show how to construct an extended parser of O(|G| + #LA|N|2kk log k) size where |N| is the number of nonterminal symbols and #LA is the number of possible lookaheads with respect to the grammar G. As the usual parser, this extended parser uses only tables as data structure. Using some ingenious data structures and increasing the parsing time by a small constant factor, the size of the extended parser can be reduced to O(|G|+#LA|N|k2). The parsing time is O(ld(input) + k|G|n) where ld(input) is the length of the derivation of the input. Moreover, we have constructed a one pass parser.

Last Change: 12/13/10 at 13:36:22
Universität Bonn -> Institut für Informatik -> Abteilung V

Powered by Zope