Start of CONSTRUCTOR for the Grammar G13.grm Sat Apr 03 15:43:40 2004

Terminal alphabet

# 1 = #
# 2 = a
# 3 = b
# 4 = 1
# 5 = c
# 6 = d


Nonterminal alphabet

# 7 = `T'
# 8 = `S'
# 9 = `A'
#10 = `B'


Productions

P 1: `T' -> # `S' #
P 2: `S' -> a `A' a
P 3: `S' -> b `A' b
P 4: `S' -> a `B' b
P 5: `S' -> b `B' a
P 6: `A' -> 1
P 7: `B' -> 1
P 8: `A' -> `B' c
P 9: `B' -> d `A'

Leftmost-set

Symbol#ab1cdTSAB
7.T*000000000
8.S0**0000000
9.A000*0*000*
10.B000*0*0000

Rightmost-set

Symbol#ab1cdTSAB
7.T*000000000
8.S0**0000000
9.A000**00000
10.B000**000*0

Leftmost & rightmost sets

`T' leftmost set: `#'
`T' rightmost set: #

`S' leftmost set: `a' , `b'
`S' rightmost set: a , b

`A' leftmost set: `1' , `d' , `B'
`A' rightmost set: 1 , c

`B' leftmost set: `1' , `d'
`B' rightmost set: 1 , c , A


Precedence matrix

Symbol#ab1cdTSAB
1.#0<<0000=00
2.a>00<0<00= 3
3.b>00<0<00= 3
4.10>>0>00000
5.c0>>0>00000
6.d000<0<00=<
7.T0000000000
8.S=000000000
9.A0 5 50>00000
10.B0==0=00000

The relationships of symbol #1 #:
<• a<• b=• `S'

The relationships of symbol #2 a:
•> #<• 1<• d=• `A'<•=• `B'

The relationships of symbol #3 b:
•> #<• 1<• d=• `A'<•=• `B'

The relationships of symbol #4 1:
•> a•> b•> c

The relationships of symbol #5 c:
•> a•> b•> c

The relationships of symbol #6 d:
<• 1<• d=• `A'<• `B'

The relationships of symbol #7 `T':

The relationships of symbol #8 `S':
=• #

The relationships of symbol #9 `A':
=••> a=••> b•> c

The relationships of symbol #10 `B':
=• a=• b=• c


Precedence varies


P2-conflict:
a <•=• `B'
The source is the production P 4: `S' -> a `B' b
I'll add a new NT P10: `S1' -> `B' b
I'll change the production P 4: `S' -> a `S1'

P2-conflict:
b <•=• `B'
The source is the production P 5: `S' -> b `B' a
I'll add a new NT P11: `S2' -> `B' a
I'll change the production P 5: `S' -> b `S2'

Leftmost-set

Symbol#ab1cdTSABS1S2
7.T*00000000000
8.S0**000000000
9.A000*0*000*00
10.B000*0*000000
11.S1000*0*000*00
12.S2000*0*000*00

P1-conflict:
`A' =••> a
The source is the production P 2: `S' -> a `A' a
I'll add a new NT P12: `S3' -> a `A'
I'll change the production P 2: `S' -> `S3' a

P1-conflict:
`A' =••> b
The source is the production P 3: `S' -> b `A' b
I'll add a new NT P13: `S4' -> b `A'
I'll change the production P 3: `S' -> `S4' b

New grammar

P 1: `T' -> # `S' #
P 2: `S' -> `S3' a
P 3: `S' -> `S4' b
P 4: `S' -> a `S1'
P 5: `S' -> b `S2'
P 6: `A' -> 1
P 7: `B' -> 1
P 8: `A' -> `B' c
P 9: `B' -> d `A'
P10: `S1' -> `B' b
P11: `S2' -> `B' a
P12: `S3' -> a `A'
P13: `S4' -> b `A'

Leftmost-set

Symbol#ab1cdTSABS1S2S3S4
7.T*0000000000000
8.S0**000000000**
9.A000*0*000*0000
10.B000*0*00000000
11.S1000*0*000*0000
12.S2000*0*000*0000
13.S30*000000000000
14.S400*00000000000

Rightmost-set

Symbol#ab1cdTSABS1S2S3S4
7.T*0000000000000
8.S0**0000000**00
9.A000**000000000
10.B000**000*00000
11.S100*00000000000
12.S20*000000000000
13.S3000**000*00000
14.S4000**000*00000

Leftmost & rightmost sets

`T' leftmost set: `#'
`T' rightmost set: #

`S' leftmost set: `a' , `b' , `S3' , `S4'
`S' rightmost set: a , b , S1 , S2

`A' leftmost set: `1' , `d' , `B'
`A' rightmost set: 1 , c

`B' leftmost set: `1' , `d'
`B' rightmost set: 1 , c , A

`S1' leftmost set: `1' , `d' , `B'
`S1' rightmost set: b

`S2' leftmost set: `1' , `d' , `B'
`S2' rightmost set: a

`S3' leftmost set: `a'
`S3' rightmost set: 1 , c , A

`S4' leftmost set: `b'
`S4' rightmost set: 1 , c , A


Precedence matrix

Symbol#ab1cdTSABS1S2S3S4
1.#0<<0000=0000<<
2.a>00<0<00=<=000
3.b>00<0<00=<0=00
4.10>>0>000000000
5.c0>>0>000000000
6.d000<0<00=<0000
7.T00000000000000
8.S=0000000000000
9.A0>>0>000000000
10.B0==0=000000000
11.S1>0000000000000
12.S2>0000000000000
13.S30=000000000000
14.S400=00000000000

The relationships of symbol #1 #:
<• a<• b=• `S'<• `S3'<• `S4'

The relationships of symbol #2 a:
•> #<• 1<• d=• `A'<• `B'=• `S1'

The relationships of symbol #3 b:
•> #<• 1<• d=• `A'<• `B'=• `S2'

The relationships of symbol #4 1:
•> a•> b•> c

The relationships of symbol #5 c:
•> a•> b•> c

The relationships of symbol #6 d:
<• 1<• d=• `A'<• `B'

The relationships of symbol #7 `T':

The relationships of symbol #8 `S':
=• #

The relationships of symbol #9 `A':
•> a•> b•> c

The relationships of symbol #10 `B':
=• a=• b=• c

The relationships of symbol #11 `S1':
•> #

The relationships of symbol #12 `S2':
•> #

The relationships of symbol #13 `S3':
=• a

The relationships of symbol #14 `S4':
=• b


Grammar G13.grm is a precedence grammar

Grammar G13.grm is not invertible


Left Context


Symbol#ab1cdTSABS1S2S3S4
7.T00000000000000
8.S*0000000000000
9.A0**00*00000000
10.B0**00*00000000
11.S10*000000000000
12.S200*00000000000
13.S3*0000000000000
14.S4*0000000000000

Right Context


Symbol#ab1cd
7.T000000
8.S*00000
9.A0**0*0
10.B0**0*0
11.S1*00000
12.S2*00000
13.S30*0000
14.S400*000


Independent context

`T' left context:
`T' right context:

`S' left context: #
`S' right context: #

`A' left context: a , b , d
`A' right context: a , b , c

`B' left context: a , b , d
`B' right context: a , b , c

`S1' left context: a
`S1' right context: #

`S2' left context: b
`S2' right context: #

`S3' left context: #
`S3' right context: a

`S4' left context: #
`S4' right context: b


Equivalent definitions:
`A' —> 1 & `B' —> 1
`A' left context: a , b , d
`A' right context: a , b , c

`B' left context: a , b , d
`B' right context: a , b , c


The independent context of `A' and `B' is not different

independent context didn't help us. I'll try to use the dependent one.


I'll find the subsets of dependent context of `A'
gamma2: the source is the production
P=13 `S4' -> b `A'
{b , b}
gamma2: the source is the production
P=12 `S3' -> a `A'
{a , a}
gamma2: the source is the production
P=9 `B' -> d `A'
{d , a} {d , b} {d , c}

The set of dependent context of `A':
{a , a} {b , b} {d , a} {d , b} {d , c}


I'll find the subsets of dependent context of `B'
gamma3: the source is the production
P=11 `S2' -> `B' a
{b , a}
gamma3: the source is the production
P=10 `S1' -> `B' b
{a , b}
gamma3: the source is the production
P=8 `A' -> `B' c
{a , c} {b , c} {d , c}

The set of dependent context of `B':
{a , b} {a , c} {b , a} {b , c} {d , c}

test_dep_con A and B

common:
{d , c}

dependent context is not different:
A and B


Grammar G13.grm is not BRC-reducible


The following pairs of nonterminals are having nondifferent context:
`A'and `B'

Finish of CONSTRUCTOR Sat Apr 03 15:43:40 2004