LR(0) tilstande
State 0
Goto (State 0, S) = new State 1
Goto (State 0, V) = new State 2
Goto (State 0, E) = new State 3
Goto (State 0, x) = new State 4
Goto (State 0, *) = new State 5
For State 1 er vi færdig da kun dot lige før $.
Goto (State 2, =) = new State 6
For State 3 og State 4 er vi færdig da kun dot for enden af en produktion
Goto (State 5, E) = new State 7
Goto (State 5, V) = new State 8
Goto (State 5, x) = State 4
Goto (State 5, *) = State 5
Goto (State 6, E) = new State 9
Goto (State 6, V) = State 8
Goto (State 6, x) = State 4
Goto (State 6, *) = State 5
State 7, State 8 og State 9 er vi færdige med da dot for enden af produktionen
Vi skal bruge Nullable, FIRST og FOLLOW mængder
Nullable | FIRST | FOLLOW | |
---|---|---|---|
S' | Nej | {x, *} | {} |
S | Nej | {x, *} | {$} |
V | Nej | {x, *} | {=, $} |
E | Nej | {x, *} | {=, $} |
= | Nej | {=} | - |
x | Nej | {x} | - |
* | Nej | {*} | - |
$ | Nej | {$} | - |
Parsetabellen bliver
State | = | x | * | $ | S | V | E |
---|---|---|---|---|---|---|---|
0 | s4 | s5 | g1 | g2 | g3 | ||
1 | accept | ||||||
2 | s7/r3 | r3 | |||||
3 | r2 | ||||||
4 | r4 | r4 | |||||
5 | s4 | s5 | g8 | g7 | |||
6 | s4 | s5 | g8 | g9 | |||
7 | r5 | r5 | |||||
8 | r3 | r3 | |||||
9 | r1 |
Følger, den kigger vi på til seminar 2.
Her er et link til en zip fil køre ant fra det udpakkede directory grammar3_32.zip.
Venlig hilsen
Kristian Torp
torp (at) cs (dot) auc (dot) dk