Analisi sintattica
Analisi sintattica
Analisi sintattica
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Left-Factoring (fattorizzazione<br />
sinistra)<br />
Un parser top down deterministico richiede<br />
una grammatica left-factored.<br />
grammatica grammatica equivalente<br />
istr → if (expr ) istr else istr |<br />
if (expr) istr<br />
Left-Factoring (cont.)<br />
In generale,<br />
A → αβ1 | αβ2 dove α∈(V∪T)* - {ε}, β1∈ (V∪T)* - {ε}, β2∈ (V∪T)* -<br />
{ε}<br />
e β1≠. Noi possiamo riscrivere la grammatica come segue<br />
A → αA ’<br />
A’ →β 1 | β 2<br />
16