Question: Really need help with this entire question. I don't understand how to do any of the problem, the textbook isn't much help. 1. Consider the

Really need help with this entire question. I don't understand how to do any of the problem, the textbook isn't much help. Really need help with this entire question. I don't understand how to

1. Consider the following grammar G = (V,T,S,P), where the set of non-terminal symbols is V = {prog,id-list,decls, comp-stmts, type, stmt-list, stmt,uariable, exp, term, factor); the set of terminal symbols T-{ prog, id, left paren, right paren, semi coln, period comma, var, coln, int, real, begin, end, assignop, mulop, num J; the start symbol is prog; and the set of production rules P are as follows: prog-> prog id left-paren id-list right-paren semi-coln decls comp-stmts period id-list id | id-list comma id decls decls var idList coln type semi-coln | E type int l real comp-stmts begin stmt-list end stmt-list stmt | stmt list semi coln stmt stmt variable assignp exp variable d exp term term factor term mulop factor factor id | num (a) Construct a grammar G1 by remove all left-recursions from G such that G is equivalent to G. (b) Construct the FIRST and FOLLOW sets for each non-terminal symbol in G1 (c) Construct a predictive parser (i.e., a parsing table) for Gi (d) Apply your parser to the following input string and construct a parse tree. You should show all stack operations prog id left paren id comma id right-paren semi coln var id coln int semi coln var id comma id coln real semi_coln begin id assignop num mulop num semi coln id assignop id end period

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!