Reputation: 23
I have an impression but I am not entirely sure it is right. If a grammar is not ambiguous, can it have First/Follow conflicts? I am fairly sure it can't, but I would like to have some confirmation.
Thank you.
Upvotes: 2
Views: 2127
Reputation: 372664
Unambiguous grammars can have first/follow conflicts. Here's an example:
S → Ab
A → b | ε
This grammar can produce two strings, bc
and bbc
, and it's unambiguous. However, there's a FIRST/FOLLOW conflict on production A → b | ε, because b
∈ FIRST(A) and b
∈ FOLLOW(A) as well.
Hope this helps!
Upvotes: 2