|
A nyelvtan:
![$\mathbf{T_0=\epsilon}$](img2.gif) |
T0S=T1 |
T1a=T2 |
|
|
|
![$S'\ensuremath{\rightarrow}\ensuremath{\mathbf{.}} S,\;\epsilon$](img3.gif) |
![$S'\ensuremath{\rightarrow} S\ensuremath{\mathbf{.}} ,\;\epsilon$](img4.gif) |
![$S\ensuremath{\rightarrow} Sa\ensuremath{\mathbf{.}} SaSb,\;\epsilon\vert a$](img5.gif) |
![$S\ensuremath{\rightarrow}\ensuremath{\mathbf{.}} SaSaSb,\;\epsilon\vert a$](img6.gif) |
![$S\ensuremath{\rightarrow} S\ensuremath{\mathbf{.}} aSaSb,\;\epsilon\vert a$](img7.gif) |
![$S\ensuremath{\rightarrow}\ensuremath{\mathbf{.}} SaSaSb\;,
\;a$](img8.gif) |
![$S\ensuremath{\rightarrow}\ensuremath{\mathbf{.}} ,\;\epsilon\vert a$](img9.gif) |
|
![$A\ensuremath{\rightarrow}\ensuremath{\mathbf{.}} ,\;a$](img10.gif) |
|
|
|
T2S=T3 |
T3a=T4 |
T4S=T5 |
|
|
|
![$S\ensuremath{\rightarrow} SaS\ensuremath{\mathbf{.}} aSb ,\;\epsilon\vert a$](img11.gif) |
![$S\ensuremath{\rightarrow} SaSa\ensuremath{\mathbf{.}} Sb ,\;\epsilon\vert a$](img12.gif) |
![$S\ensuremath{\rightarrow} SaSaS\ensuremath{\mathbf{.}} b,\;\epsilon\vert a$](img13.gif) |
![$S\ensuremath{\rightarrow} S\ensuremath{\mathbf{.}} aSaSb ,\;a$](img14.gif) |
![$S\ensuremath{\rightarrow} Sa\ensuremath{\mathbf{.}} SaSb ,\;a$](img15.gif) |
![$S\ensuremath{\rightarrow} SaS\ensuremath{\mathbf{.}} aSb,\;a$](img16.gif) |
|
![$S\ensuremath{\rightarrow}\ensuremath{\mathbf{.}} SaSaSb ,\;a\vert b$](img17.gif) |
![$S\ensuremath{\rightarrow} S\ensuremath{\mathbf{.}} aSaSb,\;a\vert b$](img18.gif) |
|
![$S\ensuremath{\rightarrow}\ensuremath{\mathbf{.}} , a\vert b$](img19.gif) |
|
|
|
|
T5b=T6 |
T5a=T7 |
T7S=T8 |
![$S\ensuremath{\rightarrow} SaSaSb\ensuremath{\mathbf{.}} ,\;\epsilon\vert a$](img20.gif) |
![$S\ensuremath{\rightarrow} SaSa\ensuremath{\mathbf{.}} Sb ,\;a$](img21.gif) |
![$S\ensuremath{\rightarrow} SaSaS\ensuremath{\mathbf{.}} b,\;a$](img22.gif) |
|
![$S\ensuremath{\rightarrow} Sa\ensuremath{\mathbf{.}} SaSb ,\;a\vert b$](img23.gif) |
![$S\ensuremath{\rightarrow} SaS\ensuremath{\mathbf{.}} aSb,\;a\vert b$](img24.gif) |
|
![$S\ensuremath{\rightarrow}\ensuremath{\mathbf{.}} SaSaSb ,\;a\vert b$](img17.gif) |
![$S\ensuremath{\rightarrow} S\ensuremath{\mathbf{.}} aSaSb,\;a\vert b$](img18.gif) |
|
![$S\ensuremath{\rightarrow}\ensuremath{\mathbf{.}} , a\vert b$](img19.gif) |
|
|
|
|
T8b=T9 |
T8a=T10 |
T10S=T11 |
![$S\ensuremath{\rightarrow} SaSaSb\ensuremath{\mathbf{.}} ,\;a$](img25.gif) |
![$S\ensuremath{\rightarrow} SaSa\ensuremath{\mathbf{.}} Sb ,\;a\vert b$](img26.gif) |
![$S\ensuremath{\rightarrow} SaSaS\ensuremath{\mathbf{.}} b,\;a\vert b$](img27.gif) |
|
![$S\ensuremath{\rightarrow} Sa\ensuremath{\mathbf{.}} SaSb ,\;a\vert b$](img23.gif) |
![$S\ensuremath{\rightarrow} SaS\ensuremath{\mathbf{.}} aSb,\;a\vert b$](img24.gif) |
|
![$S\ensuremath{\rightarrow}\ensuremath{\mathbf{.}} SaSaSb ,\;a\vert b$](img17.gif) |
![$S\ensuremath{\rightarrow} S\ensuremath{\mathbf{.}} aSaSb,\;a\vert b$](img18.gif) |
|
![$S\ensuremath{\rightarrow}\ensuremath{\mathbf{.}} , a\vert b$](img19.gif) |
|
|
|
|
T11b=T12 |
T11a=T10 |
|
![$S\ensuremath{\rightarrow} SaSaSb\ensuremath{\mathbf{.}} ,\;a\vert b$](img28.gif) |
|
|
|
|
|
Megjegyzés: T1-nél látni, hogy LR(0)-val ütközés lenne.
Nézzük a táblát:
|
a |
b |
![$\epsilon$](img29.gif) |
a |
b |
S |
T0 |
2 |
|
2 |
|
|
T1 |
T1 |
S |
|
A |
T2 |
|
|
T2 |
2 |
|
|
|
|
T3 |
T3 |
S |
|
|
T4 |
|
|
T4 |
2 |
2 |
|
|
|
T5 |
T5 |
S |
S |
|
T7 |
T6 |
|
T6 |
1 |
|
1 |
|
|
|
T7 |
2 |
2 |
|
|
|
T8 |
T8 |
S |
S |
|
T10 |
T9 |
|
T9 |
1 |
|
|
|
|
|
T10 |
2 |
2 |
|
|
|
T11 |
T11 |
S |
S |
|
T10 |
T12 |
|
T12 |
1 |
1 |
|
|
|
|
És egy elemzés:
Accept.
|