Question

Find context-sensitive grammars for the following languages: (a) L = {anbncndn : n≥1}

Find context-sensitive grammars for the following languages:

(a) L = {anbncndn : n≥1}

Homework Answers

Answer #1

Context sensitive grammar:

If there exists production a->b

Then a,b belongs to (VuT)+

Where V represents variables and T represents Terminals.

Language represented by given grammar= { abcd,aabbccdd,aaabbbcccddd….}

Observations:

Each symbol a,b,c,d should be in same number.

But it should not be zero length string, hence Epsilon not required in the start symbol.

String starts with a and end with d.

Smallest string accepted by grammar is abcd.

Writing grammar by considering above observations:

S->aBSCd | abcd

Ba->aB

dC->Cd

cC->cc

Bb->bb

Verification:

aabbccdd

S->aBSCd

->aBabcdCd

->aaBbcdCd

-> aaBbcCdd

->aaBbccdd

->aabbccdd

Hence given string is accepted.

Variables: S,B,C

terminals: a,b,c,d

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Using the pumping lemma for context free Languages to prove L is not context free. L...
Using the pumping lemma for context free Languages to prove L is not context free. L = { w#w#w | w E (0+1)*} Are the used variables {0,1,#}
Automata Theory and Formal Languages Problems 1: Consider the following two grammars. Grammar G1- S →...
Automata Theory and Formal Languages Problems 1: Consider the following two grammars. Grammar G1- S → aSb / ∈ Grammar G2- S → aAb / ∈, A → aAb / ∈ a. is G1=G2 b. What is the grammar generated by the expression Problem 2: Let us consider the grammar. G2 = ({S, A}, {a, b}, S, {S → aAb, aA → aaAb, A → ε } ) Derive aaabbb Problem 3: Suppose we have the following grammar. G: N...
10.5.1 Explain how linear bounded automata could be constructed to accept the following languages: (a)L= {...
10.5.1 Explain how linear bounded automata could be constructed to accept the following languages: (a)L= { a2 :n=m2,m≥1} (explanation is much appreciated)
Let swap_every_two be an operation on languages that is defined as follows: swap_every_two(L) = {a2a1a4a3 ....
Let swap_every_two be an operation on languages that is defined as follows: swap_every_two(L) = {a2a1a4a3 . . . a2na2n−1 | a1a2a3a4 . . . a2n−1a2n ∈ L where a1, . . . , a2n ∈ Σ} In this definition, Σ is the alphabet for the language L. 1. What languages result from applying swap every two to the following languages: (a) {1 n | n ≥ 0}, where the alphabet is {1}. (b) {(01)n | n ≥ 0}, where the...
prove that the language L over {c,d,e} is not context free. (using pumping lemma for context...
prove that the language L over {c,d,e} is not context free. (using pumping lemma for context free languages) L= {w ∈ {c,d,e}* : number of c's, number of d's, and number of e's have a common factor greater than 1}
L = { am b n | m < n - 2}. (a) Define the context...
L = { am b n | m < n - 2}. (a) Define the context free grammar G that generates the formal language L. (b) Define the deterministic pushdown automaton A that recognize the formal language L. (c) Implement the pushdown automaton A in your favorite programming language.
L = { am b n | m < n - 2}. (a) Define the context...
L = { am b n | m < n - 2}. (a) Define the context free grammar G that generates the formal language L. (b) Define the deterministic pushdown automaton A that recognize the formal language L. (c) Implement the pushdown automaton A in your favorite programming language.
Context Free Grammars and Parse Trees Write a grammar rule for parsing an ifStatement. Specifically, you...
Context Free Grammars and Parse Trees Write a grammar rule for parsing an ifStatement. Specifically, you should consider the following: an ifStatement should Start with the ‘if’ keyword, Require parenthesis around the condition, Can have any expression for the condition (you do not need to write a rule for expressions, you can assume one exists named expression), The condition is followed by the ‘then’ keyword, Which is followed by zero or more statements (you do not need to write a...
Find the probabilities for the n = 2, l = 0 and n = 2, l...
Find the probabilities for the n = 2, l = 0 and n = 2, l = 1 electron states in hydrogen to be further than r = 5a0 from the nucleus. Which has the greater probability to be far from the nucleus?
Are the following languages over {a, b} regular? If they are then prove it. If they...
Are the following languages over {a, b} regular? If they are then prove it. If they are not prove it with the Pumping Lemma {an bm | m != n, n >= 0} {w | w contains the substring ‘aaa’ once and only once } Clear concise details please, if the language is regular, provide a DFA/NFA along with the regular expression. Thank you. Will +1
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT