共 50 条
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
来源:
关键词:
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
相关论文