Practical arbitrary lookahead LR parsing

作者:

Highlights:

摘要

We present a practical technique for computing lookahead for an LR(0) parser, that progressively attempts single-symbol, multi-symbol, and arbitrary lookahead. The technique determines the amount of lookahead required, and the user is spared the task of guessing it. The class of context-free grammars defined by our technique is a subset of the LR-regular grammars; we show that unlike LR-regular, the problem of determining whether an arbitrary grammar is in the class, is decidable. When restricted to k-symbol lookahead, the technique has the power of LALR(k) parsers. It has been successfully used to resolve multi-symbol lookahead conflicts in grammars for FORTRAN, Ada, C, COBOL, and PL/I, and its performance compares favorably with that of two well-known, commercially available parser generators.

论文关键词:

论文评审过程:Received 2 January 1988, Revised 12 November 1988, Available online 2 December 2003.

论文官网地址:https://doi.org/10.1016/0022-0000(90)90037-L