Extended LALR(1) Parsing

被引:0
作者
Yang, Wuu [1 ]
机构
[1] Natl Chiao Tung Univ, Dept Comp Sci, Hsinchu, Taiwan
来源
THIRTEENTH INTERNATIONAL CONFERENCE ON AUTONOMIC AND AUTONOMOUS SYSTEMS (ICAS 2017) | 2017年
关键词
context-free grammar; grammar; extended LALR parser; LR parser; LALR parser; parsing;
D O I
暂无
中图分类号
TP [自动化技术、计算机技术];
学科分类号
0812 ;
摘要
We identify a class of context-free grammars, called the extended LALR(1) (ELALR(1)), which is a superclass of LALR(1) and a subclass of LR(1). Our algorithm is essentially a smarter method for merging similar states in the LR(1) state machines. LALR(1) would merge every pair of similar states. In contrast, our algorithm merges a pair of similar states only if no (reduce-reduce) conflicts will be created. Thus, when no conflicts occur, our algorithm produces exactly the same state machines as the LALR(1) algorithm. However, when the LALR(1) algorithm reports conflicts, our algorithm may still produce a (larger) conflict-free state machine. In the extreme case when no states can be merged, our algorithm simply returns the original LR(1) machines. An important characteristic of the ELALR(1) algorithm is that there is no backtracking. On the other hand, the ELALR(1) algorithm does not guarantee the minimum state machines.
引用
收藏
页码:30 / 35
页数:6
相关论文
共 10 条
[1]  
Aho A. V., 1974, Computing Surveys, V6, P99, DOI 10.1145/356628.356629
[2]  
Anderson T., 1973, ACTA INFORM, V2, P2
[3]  
[Anonymous], 2006, COMPILERS PRINCIPLES
[4]   EFFICIENT COMPUTATION OF LALR(1) LOOK-AHEAD SETS [J].
DEREMER, F ;
PENNELLO, T .
ACM TRANSACTIONS ON PROGRAMMING LANGUAGES AND SYSTEMS, 1982, 4 (04) :615-649
[5]  
DeRemer F. L., 1969, TR65 MIT PROJ MAC
[6]  
Fischer C. N., 2010, CRAFTING A COMPILER
[7]  
Johnson S.C., 1978, YACC YET ANOTHER COM
[8]   ON TRANSLATION OF LANGUAGES FROM LEFT TO RIGHT [J].
KNUTH, DE .
INFORMATION AND CONTROL, 1965, 8 (06) :607-&
[9]   TRANSFORMING LR(K) GRAMMARS TO LR(1), SLR(1), AND (1,1) BOUNDED RIGHT-CONTEXT GRAMMARS [J].
MICKUNAS, MD ;
LANCASTER, RL ;
SCHNEIDER, VB .
JOURNAL OF THE ACM, 1976, 23 (03) :511-533
[10]   PRACTICAL GENERAL METHOD FOR CONSTRUCTING LR(K) PARSERS [J].
PAGER, D .
ACTA INFORMATICA, 1977, 7 (03) :249-268