Syntax Analysis14

0. Consider the following expression grammar G:
E → E – T|T
T → T + F|F
F → (E)|id
Which of the following grammars is not left recursive, but is equivalent to G?

  • Option : C
  • Explanation :
    left recursion: A → Aα/β
    After removing left recursion it can be written as
    A → βA’
    A' → αA'/ε
    So apply above rule for Variable E and T resultant grammar is
    E → TX
    X → – TX|ε
    T → FY
    Y → +FY|ε
    F → (E) → id
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *