

































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


































derives x, x+x, x+x+x,
x * y
x + y * z ...
Exp y * z / |
Exp + Exp | / | \
id(x) Exp * Exp
Exp z / |
Exp + Exp | / | \
id(x) Exp * Exp
| id(y)
Grammar Transformations
st ::= if exp then st else st | if exp then st | id := exp
st -> match | unmatch match -> if exp then match else match | id := exp unmatch -> if exp then st | if exp then match else unmatch
T n
T n T n a
**(a | b) (n | m) ***
“a” and “b” because they are the rhs of the non-left recurive productions.
Left Recursive Grammar
Alt -> Alt bar Concat Alt -> Concat Concat -> Concat Closure Concat -> Closure Closure -> simple star
Closure -> simple
simple -> id | (Alt ) | #
Alt ::= Concat moreAlt moreAlt ::= Bar Concat moreAlt | ε Concat ::= Closure moreConcat moreConcat ::= Closure moreConcat | ε Closure ::= Simple Star | Simple Simple ::= Id | ( Alt ) | #
1. For every Non terminal with productions T ::= T n | T m (left recursive **productions) | a | b (non-left recursive productions)