Generation of LR parsers by partial evaluation

被引:4
|
作者
Sperber, M
Thiemann, P
机构
[1] Univ Tubingen, Wilhelm Schickard Inst Informat, D-72076 Tubingen, Germany
[2] Univ Freiburg, Inst Informat, D-79110 Freiburg, Germany
来源
ACM TRANSACTIONS ON PROGRAMMING LANGUAGES AND SYSTEMS | 2000年 / 22卷 / 02期
关键词
algorithms; experimentation; languages; performance; continuations; functional programming; LR parsing; parser generation; partial evaluation;
D O I
10.1145/349214.349219
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
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.
引用
收藏
页码:224 / 264
页数:41
相关论文
共 50 条
  • [21] METHOD FOR OPTIMIZING LR-PARSERS
    KOSKIMIES, K
    SOISALONSOININEN, E
    INTERNATIONAL JOURNAL OF COMPUTER MATHEMATICS, 1979, 7 (04) : 287 - 295
  • [22] ALTERNATIVE APPROACH TO IMPROVEMENT OF LR(K) PARSERS
    BACKHOUSE, RC
    ACTA INFORMATICA, 1976, 6 (03) : 277 - 296
  • [23] Reachability and Error Diagnosis in LR(1) Parsers
    Pottier, Francois
    PROCEEDINGS OF THE 25TH INTERNATIONAL CONFERENCE ON COMPILER CONSTRUCTION (CC 2016), 2016, : 88 - 98
  • [24] AUTOMATIC CONSTRUCTION OF INCREMENTAL LR(1)-PARSERS
    YEH, DS
    KASTENS, U
    SIGPLAN NOTICES, 1988, 23 (03): : 33 - 42
  • [25] SHIFT-REDUCE CONFLICTS IN LR PARSERS
    PEZARIS, SD
    SIGPLAN NOTICES, 1989, 24 (11): : 94 - 95
  • [26] COMPARISON OF SYNTACTIC ERROR HANDLING IN LR PARSERS
    DEGANO, P
    PRIAMI, C
    SOFTWARE-PRACTICE & EXPERIENCE, 1995, 25 (06): : 657 - 679
  • [27] HANDLING AMBIGUOUS TOKENS IN LR-PARSERS
    KANZE, J
    SIGPLAN NOTICES, 1989, 24 (06): : 49 - 54
  • [28] ELIMINATING UNIT PRODUCTIONS FROM LR PARSERS
    PAGER, D
    ACTA INFORMATICA, 1977, 9 (01) : 31 - 59
  • [29] Disambiguation filters for scannerless generalized LR parsers
    van den Brand, MGJ
    Scheerder, J
    Vinju, JJ
    Visser, E
    COMPILER CONSTRUCTION, PROCEEDINGS, 2002, 2304 : 143 - 158
  • [30] INCREMENTAL GENERATION OF PARSERS
    HEERING, J
    KLINT, P
    REKERS, J
    SIGPLAN NOTICES, 1989, 24 (07): : 179 - 191