Professional Documents
Culture Documents
GrammarTypes PDF
GrammarTypes PDF
Example1: Let A and B be non-terminals and let x and y be terminal symbols. The
following grammar is not regular; it is context-free. Why?
A B y
B x A
A x
Example2: Let A and B be non-terminals and let x and y be terminal symbols. The
following grammar is regular; it is also context-free. Why?
A B x y
B A x y
A x
If A is the start symbol, then the language generated by this grammar is the same as the
language specified by the following regular expression:
x (x y x y)*
If B is the start symbol, then the language generated by this grammar is the same as the
language specified by the following regular expression:
x x y (x y x y)*