Question

3. Use the algorithm described in Section 4.4.2 of Sebesta to remove direct left recursion. from the following grammar: S Sa l a l SA I b

0 0
Add a comment Improve this question Transcribed image text
Answer #1

S -> Sa
   | a
   | SA
   | b

A -> bA
   | aS


To remove left recursion, we need to change all the derivations of the forms:
A -> Ax | b
to:
A -> bA'
A' -> xA' | epsilon


So, applying the above formula to the given Grammar,
S -> aS'
S' -> aS' | epsilon

S -> bX'
X' -> AX' | epsilon

A -> bA | aS

Add a comment
Know the answer?
Add Answer to:
Use the algorithm described in Section 4.4.2 of Sebesta to remove direct left recursion from the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT