For each of
the following grammars, first classify the grammar as Regular,
Linear,
Context-Free or
Context-Sensitive,
and
then precisely
describe the language generated by the grammar.
(1) S →
aRa
R → aR |
bR | є
(2) S → A |
B
A →
aaaA
| є
B →
Bbb
| b
(3) S →
RbR
R → aRb | bRa
| RR | bR |
є
(4)
S → aSbSaS |
aSaSbS | bSaSaS | є
(5)...
Let G = (AN , AT , S, P) be a context-free grammar in Chomsky
normal form. Prove that if there exists a word w ∈ L(G) generated
by a derivation that uses more than |P| + |AT | steps, then L(G) is
infinite.
Consider the context-free grammar G = ( {S}, {a, b}, S, P) where
P = { S -> aaSb | aab }.
Construct a NPDA M that such that L(M) = L(G).
I would like the transition graph for this NPDA please.
Let G be any context-free grammar. Show that the number of
strings that have a derivation in G of length n or less, for any n
> 0, is finite.
Could you please answer with clear explanation. The question is
from Elaine Rich's Automata, Computability and Complexity Chapter
11 Exercise 14.
Write down a Context Free Grammar with 8 productions including 4
variables and 3 terminals. i. Check whether the Context Free
Grammar is ambiguous or not. Justify your answer with necessary
example. ii. Finally, construct the reduced grammar corresponding
to your generated grammar.
Find Consider the following context-free grammar G:
S --> T#T
T --> C
A --> aA | epsilon
B --> bB | epsilon
C --> cC
C --> c
a) Give the set of unproductive symbols in G?
b) Give an equivalent grammar without useless symbols.
Consider the following context-free grammar
G:
E ® T +
E ® * T i
E ® f i
E ® * f +
T ® +
Questions:
(5 points) Compute the Canonical LR(1) Closure
set for state I0 for grammar G.
(10 points) Compute (draw) the DFA that
recognizes the Canonical LR(1) sets of items for grammar G.
(5 points) Construct the corresponding
Canonical LR(1) parsing table.
(10 points) Compute (draw) the DFA for
LALR(1).
(5 points) Construct LALR(1)...