0
$\begingroup$

Given the grammar (Uppercase alphabet is non-terminal, lower-case alphabet is terminal), how to find FIRST set?

  1. A -> mB | CD
  2. B -> CBn | epsilon
  3. C -> pA | epsilon
  4. 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

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.