S -> ( L ) | a L -> L , S | Sand the input string
(a,(a),a)
Each of the following two grammars generates the language of all strings of as with positive even lengths. Grammar 1 is
S -> a S a S -> a a
and Grammar 2 is
S -> a a S S -> a a
Of these two grammars, one of them is suitable for shift-reduce parsing, and in fact you can successfully use any of the SLR(1), LR(1), or LALR(1) parser construction techniques. The other will not work using any of the three techniques or any other technique that uses limited lookahead.
S -> a a
needs to occur. At what point
in the string will this need to happen using grammar 1? At what point
when using grammar 2? This should tell you which grammar is suitable
for use with one symbol of lookahead. (If not, you can try creating
canonical LR(1) parsers for each and see which you get stuck on.)