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
相关论文
共 50 条
  • [31] AUTOMATIC CONSTRUCTION OF INCREMENTAL LR(1)-PARSERS
    YEH, DS
    KASTENS, U
    SIGPLAN NOTICES, 1988, 23 (03): : 33 - 42
  • [32] SHIFT-REDUCE CONFLICTS IN LR PARSERS
    PEZARIS, SD
    SIGPLAN NOTICES, 1989, 24 (11): : 94 - 95
  • [33] COMPARISON OF SYNTACTIC ERROR HANDLING IN LR PARSERS
    DEGANO, P
    PRIAMI, C
    SOFTWARE-PRACTICE & EXPERIENCE, 1995, 25 (06): : 657 - 679
  • [34] HANDLING AMBIGUOUS TOKENS IN LR-PARSERS
    KANZE, J
    SIGPLAN NOTICES, 1989, 24 (06): : 49 - 54
  • [35] ELIMINATING UNIT PRODUCTIONS FROM LR PARSERS
    PAGER, D
    ACTA INFORMATICA, 1977, 9 (01) : 31 - 59
  • [36] Disambiguation filters for scannerless generalized LR parsers
    van den Brand, MGJ
    Scheerder, J
    Vinju, JJ
    Visser, E
    COMPILER CONSTRUCTION, PROCEEDINGS, 2002, 2304 : 143 - 158
  • [37] LANE-TRACING ALGORITHM FOR CONSTRUCTING LR (K) PARSERS AND WAYS OF ENHANCING ITS EFFICIENCY
    PAGER, D
    INFORMATION SCIENCES, 1977, 12 (01) : 19 - 42
  • [38] ON LLP(K) PARSERS
    PITTL, J
    JOURNAL OF COMPUTER AND SYSTEM SCIENCES, 1982, 24 (01) : 36 - 68
  • [40] Complexity of Extended vs. Classic LR Parsers
    Borsotti, Angelo
    Breveglieri, Luca
    Reghizzi, Stefano Crespi
    Morzenti, Angelo
    DESCRIPTIONAL COMPLEXITY OF FORMAL SYSTEMS, DCFS 2014, 2014, 8614 : 77 - 89