Tutorial Grammar
1.
2.
3.
4.
5.
6.
7.
Suppose a phrase-structure grammar has productions S S0, S A1, A 0. Find a derivation
of 01, 0100, and 010.
Suppose a phrase-structure grammar has productions S 1S0, S 0A, A 0. Find a
derivation of 00, 1000, and 110000.
Suppose a phrase-structure grammar has productions S S11, S 0A, S A1, A 0. Find a
derivation of 01, 0011 and 011111.
The productions of a phrase-structure grammar are S S1, S 0A, A 1. Find a derivation
of 0111.
What language is generated by the phrase-structure grammar if the productions are S S11, S
, where S is the start symbol?
What is the language generated by the grammar with productions S SA, S 0, A 1A, and
A 1, where S is the start symbol?
In the questions below let V SAB01 and T 01. For each set of productions determine
whether the resulting grammar G is
(i)
(ii)
(iii)
(iv)
a)
b)
c)
d)
e)
f)
type 0 grammar, but not type 1,
type 1 grammar, but not type 2,
type 2 grammar, but not type 3,
type 3 grammar.
S A10, AB 0.
S B, A B, B A.
S AB, A 0B1, 0B1 0.
S 1A, A 1, S .
S 1AB, AB 0B, B 0, A 1B.
S 0B, B 1A, B 0, A 0B.
8.
Let G = (V, T, S, P), where V = {a, c, A, B, S}, T = {a, c}, S is a start symbol and productions P = {S
ABc, A BB, B ac, A Bc}. If word w = acacacc belongs to the language generated by
this productions, construct the derivation tree for w. Then, write the language of this
grammar.
9.
Let V = {S,A,B,a,b} and T = {a,b}. The set P of production consists of
S AB, A ab, B bb.
a. Find the language generated by the grammar (V, T, S,P).
b. Determine the type of the above grammar.
10.
Construct phrase-structure grammars to generate language L = {1n | n 0}.