148 lines
3.4 KiB
Plaintext
148 lines
3.4 KiB
Plaintext
Created by PLY version 3.11 (http://www.dabeaz.com/ply)
|
|
|
|
Grammar
|
|
|
|
Rule 0 S' -> command
|
|
Rule 1 command -> operate NUMBER article
|
|
Rule 2 article -> attribute article
|
|
Rule 3 attribute -> COLOR
|
|
Rule 4 attribute -> MATERIAL
|
|
Rule 5 attribute -> SIZE
|
|
Rule 6 article -> KIND
|
|
Rule 7 operate -> OPERATE
|
|
|
|
Terminals, with rules where they appear
|
|
|
|
COLOR : 3
|
|
KIND : 6
|
|
MATERIAL : 4
|
|
NUMBER : 1
|
|
OPERATE : 7
|
|
SIZE : 5
|
|
error :
|
|
|
|
Nonterminals, with rules where they appear
|
|
|
|
article : 1 2
|
|
attribute : 2
|
|
command : 0
|
|
operate : 1
|
|
|
|
Parsing method: LALR
|
|
|
|
state 0
|
|
|
|
(0) S' -> . command
|
|
(1) command -> . operate NUMBER article
|
|
(7) operate -> . OPERATE
|
|
|
|
OPERATE shift and go to state 3
|
|
|
|
command shift and go to state 1
|
|
operate shift and go to state 2
|
|
|
|
state 1
|
|
|
|
(0) S' -> command .
|
|
|
|
|
|
|
|
state 2
|
|
|
|
(1) command -> operate . NUMBER article
|
|
|
|
NUMBER shift and go to state 4
|
|
|
|
|
|
state 3
|
|
|
|
(7) operate -> OPERATE .
|
|
|
|
NUMBER reduce using rule 7 (operate -> OPERATE .)
|
|
|
|
|
|
state 4
|
|
|
|
(1) command -> operate NUMBER . article
|
|
(2) article -> . attribute article
|
|
(6) article -> . KIND
|
|
(3) attribute -> . COLOR
|
|
(4) attribute -> . MATERIAL
|
|
(5) attribute -> . SIZE
|
|
|
|
KIND shift and go to state 7
|
|
COLOR shift and go to state 8
|
|
MATERIAL shift and go to state 9
|
|
SIZE shift and go to state 10
|
|
|
|
article shift and go to state 5
|
|
attribute shift and go to state 6
|
|
|
|
state 5
|
|
|
|
(1) command -> operate NUMBER article .
|
|
|
|
$end reduce using rule 1 (command -> operate NUMBER article .)
|
|
|
|
|
|
state 6
|
|
|
|
(2) article -> attribute . article
|
|
(2) article -> . attribute article
|
|
(6) article -> . KIND
|
|
(3) attribute -> . COLOR
|
|
(4) attribute -> . MATERIAL
|
|
(5) attribute -> . SIZE
|
|
|
|
KIND shift and go to state 7
|
|
COLOR shift and go to state 8
|
|
MATERIAL shift and go to state 9
|
|
SIZE shift and go to state 10
|
|
|
|
attribute shift and go to state 6
|
|
article shift and go to state 11
|
|
|
|
state 7
|
|
|
|
(6) article -> KIND .
|
|
|
|
$end reduce using rule 6 (article -> KIND .)
|
|
|
|
|
|
state 8
|
|
|
|
(3) attribute -> COLOR .
|
|
|
|
KIND reduce using rule 3 (attribute -> COLOR .)
|
|
COLOR reduce using rule 3 (attribute -> COLOR .)
|
|
MATERIAL reduce using rule 3 (attribute -> COLOR .)
|
|
SIZE reduce using rule 3 (attribute -> COLOR .)
|
|
|
|
|
|
state 9
|
|
|
|
(4) attribute -> MATERIAL .
|
|
|
|
KIND reduce using rule 4 (attribute -> MATERIAL .)
|
|
COLOR reduce using rule 4 (attribute -> MATERIAL .)
|
|
MATERIAL reduce using rule 4 (attribute -> MATERIAL .)
|
|
SIZE reduce using rule 4 (attribute -> MATERIAL .)
|
|
|
|
|
|
state 10
|
|
|
|
(5) attribute -> SIZE .
|
|
|
|
KIND reduce using rule 5 (attribute -> SIZE .)
|
|
COLOR reduce using rule 5 (attribute -> SIZE .)
|
|
MATERIAL reduce using rule 5 (attribute -> SIZE .)
|
|
SIZE reduce using rule 5 (attribute -> SIZE .)
|
|
|
|
|
|
state 11
|
|
|
|
(2) article -> attribute article .
|
|
|
|
$end reduce using rule 2 (article -> attribute article .)
|
|
|