S ::= A B C
A ::= V*
B ::= W B X
| W B Y
|
C ::= (Z Z Z)?
V ::= "pro"
W ::= "gram"
X ::= "mar"
Y ::= "ming"
Z ::= "la"
> ./testgrammar.py
Usage: testgrammar.py file ...
> ./testgrammar.py foo bar
foo: matches grammar
bar: does not match grammar
>