// Exercise 4.7.5 on page 278 purple book // RKC renamed terminals to make example clearer // This grammar is LR(1) but not LALR(1) // Note the language of this grammar is regular: (n | lambda) g (x | y) // The grammar cannot be ambiguous, since each rule for S dervies // a different string terminal Object n, g, x, y; non terminal Object S, A, B; start with S; S ::= n A x | n B y | A y | B x ; A ::= g ; B ::= g ;