A Grammar Tool

Applied by Dennis J. Darland

June 15, 2007

See

http://smlweb.cpsc.ucalgary.ca/start.html

I’ve made my grammar acceptable to it.

But you will have to copy & paste it.

This is a context free grammar that I think would appear to be propositions of Principia Mathematica.

I think the grammar for what would include only valid abbreviations would not be context free and I have never studied that.

 S -> A .

S -> A eq A.

S -> A equ A.

S -> A and A.

S -> not A.

A -> F ( V ).

A -> V e ( C ).

C -> P excl  z.

A -> P excl x.

A -> F ( w ( F w ) ).

A -> F ( P excl z ).

S -> ( ex V ) F V.

S -> ( ex F ) F V.

S -> ( ex P ) P excl V.

A ->  ( all F ) F V.

A ->  ( all V ) P excl V.

A -> ( all V ) F V.

F ->  f.

F ->  g.

P ->  p.

P ->  q.

C  ->  c.

C ->  d.

V ->  x.

V ->  y.

 

 

Back to Top http://dennisdarland.com/philosophy/index.html

Originally the grammar is not LL(1).

After 3 attempts to transform it you get:

Result of Analysis

Grammar

S →

F FF FA

|

V e ( C ) FA

|

P excl x FA

|

( F(3

|

not A .

F(3

F(1 FA

|

F( .

FA →

|

eq A

|

equ A

|

and A .

F( →

ex Fex .

Fex →

V ) F V

|

F ) F V

|

P ) P excl V .

A →

F FF

|

V e ( C )

|

P excl x

|

( F(1 .

FF →

( F(2 .

F(2

V )

|

w ( F w ) )

|

P excl z ) .

F(1

all Fall .

Fall →

F ) F V

|

V FV .

FV →

) F) .

F) →

P excl V

|

F V .

C →

P excl z

|

c

|

d .

F →

f

|

g .

P →

p

|

q .

V →

x

|

y .

Some sentences generated by this grammar: {q excl x, p excl x, x e ( d ), y e ( c ), x e ( c ), y e ( d ), not q excl x, not p excl x, not y e ( c ), not x e ( d ), not y e ( d ), not x e ( c ), not y e ( p excl z ), not y e ( q excl z ), not x e ( q excl z ), p excl x eq p excl x, not x e ( p excl z ), p excl x eq q excl x, p excl x equ p excl x, p excl x equ q excl x}

nonterminal

first set

follow set

nullable

endable

S

( not f g x y p q

no

yes

F(3

all ex

no

yes

FA

eq equ and

yes

yes

F(

Ex

no

yes

Fex

x y f g p q

no

yes

A

( f g x y p q

no

yes

FF

(

eq equ and

no

yes

F(2

w x y p q

eq equ and

no

yes

F(1

All

eq equ and

no

yes

Fall

f g x y

eq equ and

no

yes

FV

)

eq equ and

no

yes

F)

p q f g

eq equ and

no

yes

C

c d p q

)

no

no

F

f g

( w ) x y

no

no

P

p q

) excl

no

no

V

x y

eq equ and e )

no

yes

The grammar is LL(1).