我最近遇到了一个有趣的问题,我必须消除左递归,然后找到下面的问题的第一个集并遵循它。有人可以确认我做的正确还是对我做错了?
Eliminate Left Recursion:
A -> B | c
B -> C | a
C -> A | b
Simplified:
A -> A | b | a | c
My answer:
A -> aA' | bA' | cA'
A' -> A' | Epsilon
First & Follow sets:
First (A) = {a, b, c}
First (B) = {a, b, c}
First (C) = {a, b, c}
Follow(A) = {$}
Follow(B) = { }
Follow(C) = { }