Question: Convert the following to an equivalent LL ( 1 ) grammar, find all the FIRST sets and the necessary FOLLOW sets and create an parse

Convert the following to an equivalent LL(1) grammar, find all the FIRST sets and the necessary FOLLOW sets and create an parse table.
Program Header Declarations Block .
Header program id ;
Declarations-> VariableDeclarationSection ProcedureDeclarations
VariableDeclarationSection VAR VariableDeclarations
|
VariableDeclarations VariableDeclarations VariableDeclaration
| VariableDeclaration
VariableDeclaration IdentifierList : Type ;
IdentifierList IdentifierList , id
| id
Type integer
| real
ProcedureDeclarations ProcedureHeader Declarations Block ;
ProcedureHeader procedure id ;
Block begin Statements end
Statements Statements ; Statement | Statement
Statement id := Expression
| id ()
| Block
| if Expression then Statement ElseClause
| while Expression do Statement
|
ElseClause else Statement |
ExpressionList ExpressionList , Expression | Expression
Expression SimpleExpression relop SimpleExpression
| SimpleExpression
SimpleExpression Term
| addop Term
| SimpleExpression addop Term
Term Term mulop Factor
| Factor
Factor id
| num
|( Expression )
| not Factor

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!