1. Provide a precise description of the language accepted by the PDA M1 shown below. That is, describe those properties by which it can be determined whether a given string is, or is not, a member of L(M1). Also indicate whether or not M1 is deterministic, and justify your answer.
2. Let G2 be the q-grammar shown below. Present a DPDA (deterministic PDA) that accepts L(G2).
|
3. Present a PDA that accepts the language L3 = { ambm+ncn | m≥0, n≥1 }
4. Present a Chomsky Normal Form grammar that is equivalent to (i.e., generates the same language as) this context-free grammar:
S | ⟶ | AbA | c |
A | ⟶ | aAaSc | ba |
5. Consider the following Chomsky Normal Form grammar G5:
S | ⟶ | AB | a | c | (1) (2) (3) |
A | ⟶ | AS | a | (4) (5) |
B | ⟶ | SA | b | (6) (7) |
Use the CYK algorithm to determine whether or not w = acaba is a member of L(G5). Specifically, fill in the relevant cells of the matrix pictured below so that the cell in row i and column j contains Vi,j = { X ∈ {S,A,B} : X ⟹+ wi,j }, where wi,j is the substring of w beginning at its i-th symbol and ending with its j-th symbol. (Your answer is expected to include not only the answer to the question "Is acaba ∈ L(G)?" but also the correctly filled in table.)
Recall that, for i satisfying 1≤i≤|w|, X ∈ Vi,i iff X → wi,i is a production in the grammar. Meanwhile, for i and j satisfying 1≤i<j≤|w|, X ∈ Vi,j iff there exists k, where i≤k<j, and nonterminals Y and Z such that Y ∈ Vi,k, Z ∈ Vk+1,j, and X → YZ is a production in the grammar.
1 2 3 4 5 +------+------+------+------+------+ | | | | | | | | | | | | 1 | | | | | | +------+------+------+------+------+ | | | | | | | | | | 2 | | | | | +------+------+------+------+ | | | | | | | | 3 | | | | +------+------+------+ | | | | | | 4 | | | +------+------+ | | | | 5 | | +------+ |
6. A linear grammar is a CFG in which every production's right-hand side contains at most one nonterminal symbol. A right-linear grammar is a linear grammar in which any such occurrence of a nonterminal symbol must be the last symbol of that right-hand side.
(a) Describe a construction that, given a right-linear grammar GR and a linear grammar GL, produces a linear grammar G such that L(G) = L(GR) · L(GL).
(b) Apply your construction to these particular grammars and show the resulting linear grammar.
|
|
||||||||||
GR | GL |
---|