Given the grammar (Uppercase alphabet is non-terminal, lower-case alphabet is terminal), how to find FIRST set?
- A -> mB | CD
- B -> CBn | epsilon
- C -> pA | epsilon
- D -> q
This is NOT a direct left recursive (for example, B->BCn | epsilon would be direct-left-recursive) To find the FIRST set for the above grammar, if one were to use a recursion based implementation, it will run into infinite loop in B->CBn What would be the correct approach to find the FIRST set? I already saw How to find First in a left recursive grammar? for the direct left-recursive case but not sure if it applies for the grammar above