Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following grammar: (a) Point out all aspects of Grammar G12 which are not LL(1). (b) Write a new grammar which accepts the same

Consider the following grammar:

image text in transcribed

(a) Point out all aspects of Grammar G12 which are not LL(1).

(b) Write a new grammar which accepts the same language, but avoids left recursion and common left prefixes.

(c) Write the FIRST and FOLLOW sets for the new grammar.

(d) Write out the LL(1) parse table for the new grammar.

(e) Is the new grammar an LL(1) grammar? Explain your answer carefully.

Grammar G12 1. PS 2. P+SP 3. S + if E then S 4. S if E then S else S 5. S + while ES 6. S + begin P end 7. S + print E 8. S + E 9. E id 10. E + integer 11. E + E + E

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning ASP.NET 4.5 Databases

Authors: Sandeep Chanda, Damien Foggon

3rd Edition

1430243805, 978-1430243809

More Books

Students also viewed these Databases questions