- Define the language generated by the grammar $G_c= (V_n, V_t, P, delta)$ where:
- $V_n = {delta, A}$,
- $V_t = {0, 1}$,
- $P = {(delta, A0), (delta, 0delta 0), (alpha A,alpha^T alpha alpha^T)}$
Give a rule tree for one sentence of the language $L(G_c)$ generated by the grammar $G_c$.
- Assume that we are given the language: $L(G_b) = {0^n 1^k 0^k 1^n mid k, n = 1, 2,… }$. Find a context-free grammar for this language.
- Assume we are given the following grammar $G_a = (V_n, V_t, P, delta)$ where:
- $V_n = {delta, A, B}$,
- $V_t = {0, 1}$, and
- $P = {(delta, 0A), (delta, 1B), (A, 1), (B, 0B), (B,1)}$.
Find the language $L(G_a)$ generated by the grammar $G_a$.
The Assignment: http://i.imgur.com/qx2hB1u.jpg Previous Assignment + Answers:https://imgur.com/a/jO124
Asked By : Christy
Answered By : Patrick87
Start := 0 Inner 1 | 0 Start 1 Inner := 10 | 1 Inner 0
Nonterminals are Start and Inner. Terminals are 0 and 1. Let’s consider how this works: first, Start can generate $0^{n-1} S 1^{n-1}$ by applying the rule Start := 0 Start 1 $n-1$ times. It can then get $0^n I 1^n$ by applying Start := 0 Inner 1. Next, we can get $0^n1^{k-1}0^{k-1}1^n$ by applying Inner := 1 Inner 0 $k – 1$ times. Finally, we apply Inner := 10 once to get $0^n1^k0^k1^n$. (3) See the approach given for problem (1). You should find the language looks roughly like $01, 11, 101, 1001, …, 10^n1, … = 01 + 10^*1$.
Best Answer from StackOverflow
Question Source : http://cs.stackexchange.com/questions/24494 Ask a Question Download Related Notes/Documents