next up previous contents
Next: About this document ... Up: Anexe Previous: Precedenta operatorilor   Cuprins

Iesirea gramaticii exemplu

State 1 contains 1 shift/reduce conflict.

Grammar
rule 1    x -> i j
rule 2    x -> k l
rule 3    i -> 'a'
rule 4    j -> 'b' 'a'
rule 5    k -> 'a' 'b'
rule 6    l -> 'a'

Terminals, with rules where they appear

$ (-1)
'a' (97) 3 4 5 6
'b' (98) 4 5
error (256)

Nonterminals, with rules where they appear

x (5)
    on left: 1 2
i (6)
    on left: 3, on right: 1
j (7)
    on left: 4, on right: 1
k (8)
    on left: 5, on right: 2
l (9)
    on left: 6, on right: 2


state 0

    'a'         shift, and go to state 1

    x           go to state 10
    i           go to state 2
    k           go to state 3



state 1

    i  ->  'a' .   (rule 3)
    k  ->  'a' . 'b'   (rule 5)

    'b'         shift, and go to state 4

    'b'         [reduce using rule 3 (i)]
    $default    reduce using rule 3 (i)



state 2

    x  ->  i . j   (rule 1)

    'b'         shift, and go to state 5

    j           go to state 6



state 3

    x  ->  k . l   (rule 2)

    'a'         shift, and go to state 7

    l           go to state 8



state 4

    k  ->  'a' 'b' .   (rule 5)

    $default    reduce using rule 5 (k)



state 5

    j  ->  'b' . 'a'   (rule 4)

    'a'         shift, and go to state 9



state 6

    x  ->  i j .   (rule 1)

    $default    reduce using rule 1 (x)



state 7

    l  ->  'a' .   (rule 6)

    $default    reduce using rule 6 (l)



state 8

    x  ->  k l .   (rule 2)

    $default    reduce using rule 2 (x)



state 9

    j  ->  'b' 'a' .   (rule 4)

    $default    reduce using rule 4 (j)



state 10

    $           go to state 11



state 11

    $           go to state 12



state 12

    $default    accept


Sebastian Glita 2002-06-19