Compiler Design and Construction - Old Questions
6. Given the following grammar:
Construct the parsing table for this grammar for non-recursive predictive parser.
6 marks
|
Asked in 2072
Given Grammar;
Now, Calculating First and Follow:
FIRST
First(E) = First(T) = First(F) = { (, id }
First(E’) = { +, ∈ }
First(T’) = { *, ∈ }
FOLLOW
Follow(E) = { ), $}
Follow(E’) = { ), $}
Follow(F) = { *, +, ), $ }
Follow(T) = { +, ) , $}
Follow(T’) = { +, ) , $}
Now, the Parsing table for given grammar is as below: