0

I have a grammar that looks like this

G = ({A, B, C},{a, c},P, A),
P = {
1. A → BaC,
2. B → aB
3. B → ε, 
4. C→c
}

and I want to resolve the FIRST(2.) = {a} FOLLOW(B) = {a} conflict. But with every attempt I fail because I am not able to use the terminal symbol absorption after which the grammar looks like this

G = ({A, B, C, [Ba]},{a, c},P, A),
P = {
1. A → [Ba]C,
2. B → aB
3. B → ε, 
4. C → c
5. [Ba] → aBa | a
}

but the problem remains still the same

eja08
  • 4,600
  • 3
  • 13
  • 19
  • Since `B` is `a*` (0 or more `a`s), `Ba` and `aB` match exactly the same phrases (1 or more `a`s). – rici Jun 03 '19 at 04:10
  • @rici does that mean that I can write B -> Ba and then resolve the left reccursion to get to LL(1) ? what if I did not have B -> aB but B -> acB ? – eja08 Jun 03 '19 at 14:37
  • I guess you could create and then solve the left recursion but there is another place in the original grammar where you can apply the identity which leads to an immediate solution. – rici Jun 03 '19 at 14:51

0 Answers0