Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1. Compute the First and Follow sets as well as construct the parsing table for the
following LL(1) grammars.
a.
S→Aa
A→BD
B→b|∈
D→d|∈
b. C → P F class id X Y
P → public | ∈
F → final | ∈
X → extends id | ∈
Y → implements I | ∈
I → id J
J→,I|∈
c.
prog → stmt
stmt → if expr then block | while expr do block | expr ;
expr → term => id | isZero? term | not expr | ++ id | -- id
term → id | const
block → stmt | 1 stmts l
stmts → stmt stmts | ∈
E ->E + T
E T
T T F
T F
F F *
F →a
F →b