(1)
S' -> .S [$]
S -> .aEa [$]
S -> .aFb [$]
S -> .bFa [$]
S -> .bFb [$]
(2)
S' -> S. [$]
(3)
S -> a.Ea [$]
S -> a.Fb [$]
E -> . e [a]
F -> . e [b]
(4)
S -> aE.a [$]
(5)
S -> aEa. [$]
(6)
S -> aF.b [$]
(7)
S -> aFb. [$]
(8)
S -> b.Fa [$]
S -> b.Eb [$]
E -> e. [b][a]
F -> e. [a][b]
(95)
S -> bFaE.a [$]
(106)
S -> bFaaEa. [$]
(117)
S -> bEaF.b [$]
(128)
S -> bEbaFb. [$]
So I'm actually not convinced that this grammar is not LALR(1), because no two LR(1) configurating sets have the same core. Consequently, these are also the LALR(1) configurating sets. There aren't any shift/reduce conflicts anywhere, so this should be a valid LALR(1) parser.
To confirm that this is indeed correct, I had bison try operating on this file:
%%
S : 'a' E 'a' | 'a' F 'b' | 'b' F 'a' | 'b' E 'b';
E : ;
F : ;
%%
No shift/reduce conflicts were reported.
However, what I can say is that this grammar is not SLR(1). If we compute FOLLOW sets, we get the following:
FOLLOW(S) = {$}
FOLLOW(E) = {a, b}
FOLLOW(F9) = {a, b}
Given this, the SLR(1) configurating sets would be the same as the LR(1) sets, but with these lookaheads:
(1)
S S' -> b.SFa [$]
S -> b.aEaEb [$]
SE -> .aFb [$]
S e -> .bFa [$][b]
SF -> .bFb [$]
(2)
S'e -> S. [$][a]
(310)
S -> a.Ea [$]
S -> a.Fb [$]
E -> e. [a, b][b]
FE -> e. [a, b][a]
(411)
S -> aEbF.a [$]
(512)
S -> aEabFa. [$]
(613)
S -> aFbE.b [$]
(714)
S -> aFbbEb. [$]
If you'll notice, states (4) and (10) have the same core, so in the LALR(1) automaton we'd merge them together to form the new state
(8)
S -> b.Fa [$]
S -> b.Eb4, [$]10)
E -> e. [a, b]
F -> e. [a, b]
(9)
S -> bF.a [$]
(10)
S -> bFa. [$]
(11)
S -> bE.b [$]
(12)
S -> bEb. [$]
Now, we have some shiftWhich now has a reduce/reduce conflicts, particularlyconflict in statesit (3all conflicts in LALR(1) and that weren't present in the LR(81) where thereparser are two reduce items (reducing E or F to/reduce, by the empty string with lookaheads a and bway).
Are you sure that This accounts for why the original question isn't to show that it'sgrammar is LR(1) but not SLR(1) or LALR(1) but not SLR(1)?.
Hope this helps!