Eliminate left recursion from the following grammar [S-->AB, A-->BS/b, B-->SA/a]
Answers
Answered by
1
Answer:
Use the algorithm to remove direct left recursion from the following grammar: S A B → as | Sa | Ab → Aa | Ba| Ab + b A grammar can be modified to eliminate direct left recursion as follows: For each nonterminal, A, 1. Group the A-rules as A + Adi Adz ... A am Bil B2 ... 1 Bn where none of the B's begins with A 2. Replace the original A-rules with A → B1A' | B2A' ... | BnA' A' + QA' | a2 A' | ... | Am A' E The symbol ε represents the empty string. A rule that has e as its RHS is called an erasure rule, because using it in a derivation effectively erases its LHS from the sentential form.
Explanation:
please add me as brainlist
Similar questions