I'm trying to solve question on LR(1) grammar :
S->AA
A->Aa
A-> b
I got stuck in state 4 when :
S-> AA. ,$
A-> A.a ,$
A->.Aa ,$
A->.a ,$
a
and A
shifted to other state and A
is reduced in the same state should I consider this grammar is not LR(1) and SLR(1) because of this conflict ?
You need to check shift-reduce(SR) or reduce-reduce(RR) problem
In state 4 which yo have mentioned there is only one reduce entry S-> AA., $
therefore there is no RR problem. Check for SR :
Reduce entry for S-> AA.,$
will be at $
for LR(1) and at follow(S), which is $
, for SLR(1).
Shift entries are only checked for terminals and not variables. Variables entry are made in GOTO part of the table while shift entries are made in ACTION part of table. Shift is only at terminal a
in case of both SLR(1 ) and LR(1).
Therefore in state provided by you there is no problem (neither SR nor RR).