Algorithms & data structures
Pascal user manual and report; 3rd ed.
Pascal user manual and report; 3rd ed.
A practical arbitrary look-ahead LR parsing technique
SIGPLAN '86 Proceedings of the 1986 SIGPLAN symposium on Compiler construction
Communications of the ACM
The theory of parsing, translation, and compiling
The theory of parsing, translation, and compiling
The Theory of Parsing, Translation, and Compiling
The Theory of Parsing, Translation, and Compiling
Building collections of LR(K) items with partial expansion of lookahead strings
ACM SIGPLAN Notices
ACM SIGPLAN Notices
LL and LR translators need k1 lookahead
ACM SIGPLAN Notices
SAC '94 Proceedings of the 1994 ACM symposium on Applied computing
On LR parsing with selective delays
CC'13 Proceedings of the 22nd international conference on Compiler Construction
Hi-index | 0.00 |
A new method for building LR(k) states and parsing tables is presented. The method aims at giving a feasible construction of a collection of LR(k) parsing tables, especially when k 1. for nontrivial grammars. To this purpose, the algorithm first attempts to build a set of normal states for the given grammar, each one associated to a single parsing action in {accept, reduce, shift}. When such an action cannot be uniquely determined, that is, when up to k input symbols have to be examined (inadequacy), further states, belonging to a new type, called look-ahead states, are computed. The action associated with inadequate states is a new parsing action, look. States are built without actual computation of the FIRSTk and EFFk functions; that is, nonterminals are kept in the context string of items composing each state, and their expansion to terminals is deferred until indispensable to solve inadequacy. The aforementioned method is illustrated; then the canonical collection of states and the canonical tables are compared with those obtained from the proposed method. A sufficient condition is stated, by which the size of parsing tables, obtained by applying this new method, is smaller than that of canonical tables. Experimental results show that such a condition is verified by the grammars of several programming languagues and that significant speed is gained by avoiding the computation of the FIRSTk function.