Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the context-free grammar with the following rules (S, A, B are nonterminals, S is the start nontermipal and a, b, c are the terminals):
Consider the context-free grammar with the following rules (S, A, B are nonterminals, S is the start nontermipal and a, b, c are the terminals): S + Ba A A-+ aA | Bc 6 B + bB ca (a) (3 marks) Determine the sets FOLLOW(S), FOLLOW(A), FOLLOW(B), as well as the sets FIRST(a) where a is any of the right sides of the productions. For each element z belonging to the set FIRST(BaA) give a derivation starting from Ba A of a string w with first symbol z (or in case E FIRST(BaA), a derivation of e from BaA). For each element z belonging to the set FOLLOW(B) give a derivation starting from S of a string w where z occurs directly after B. The derivations are not required for the other follow/first sets. (b) (2 marks) Does the grammar allow the use of recursive-descent parsing? Justify your answer - please be specific and give a detailed
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started