1 ; --------------------------------------------------------------------------- 2 ; | File: grammar3.dat Sean O'Connor 5-30-89 | 3 ; --------------------------------------------------------------------------- 4 ; 5 ; This is the grammar, 6 ; 7 ; S -> a A d | b B d | a B e | b A e 8 ; A -> c 9 ; B -> c 10 ; 11 ; which is LR(1), but not LALR(1) --- it generates a reduce-reduce conflict. 12 ; 13 ; Example 4.44, pages 237-238 of 14 ; 15 ; COMPILERS: PRINCIPLES, TECHNIQUES, AND TOOLS, 16 ; Alfred V. Aho, Ravi Sethi, and Jeffrey D. Ullman, 17 ; Addison-Wesley, 1986 18 ; 19 ; --------------------------------------------------------------------------- 20 21 22 ; Productions. 23 24 ( 25 (S -> |a| A |d| / |b| B |d| / |a| B |e| / |b| A |e| ) 26 (A -> |c|) 27 (B -> |c|) 28 ) 29 30 31 ; Terminal symbols. 32 33 ( |a| |b| |c| |d| |e| )