Consider the following grammar G: E -> E + T | T T -> T F |...

70.2K

Verified Solution

Question

Programming

Consider the following grammar G:
E -> E + T | T
T -> T F | F
F -> F* | a | b

This grammar can be used to generate regular expressions overthe alphabet {a,b} with standard precedence rules.
Show your solution for each of the following 5 points:

    1. Remove left recursion and write theresulting grammar G1.
    2. For the grammar G1, compute and write thesets FIRST for every right hand side of every production,
       and the sets FOLLOW for everyleft hand side (i.e. any non-terminal).
    3. Find and write the table for a predictiveparser
    4. Is G1 LL(1)? Justify your answer.
    5. If the answer to (4) above is yes, then traceparsing of: a* + ab*

Answer & Explanation Solved by verified expert
4.3 Ratings (493 Votes)
1 Left Recursive Grammar leads to unterminated state and thegrammar is look like as followsA A here A is repeated contineouslyfor    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students