共 50 条
On LR(k)-Parsers of Polynomial Size
被引:0
|作者:
Blum, Norbert
[1
]
机构:
[1] Univ Bonn, D-53117 Bonn, Germany
来源:
关键词:
D O I:
暂无
中图分类号:
TP301 [理论、方法];
学科分类号:
081202 ;
摘要:
Usually, a parser for an LR(k)-grammar G is a deterministic pushdown transducer winch produces backwards the unique rightmost derivation for a given input string x is an element of L(G). The best known upper bound for the size of such a parser is O(2(vertical bar G vertical bar vertical bar Sigma vertical bar k+1)) where vertical bar G vertical bar and vertical bar Sigma vertical bar are the sizes of the grammar G and the terminal alphabet Sigma, respectively. If we add to a parser the possibility to manipulate a directed graph of size O(vertical bar G vertical bar 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(vertical bar G vertical bar + #LA vertical bar N vertical bar 2(k) k log k) size where vertical bar N vertical bar 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(vertical bar G vertical bar + #LA vertical bar N vertical bar k(2)). The parsing time is O(ld(input) + k vertical bar G vertical bar n) where ld(input) is the length of the derivation of the input. Moreover, we have constructed a one pass parser.
引用
收藏
页码:163 / 174
页数:12
相关论文