A)-->
The given grammer is ambiguous grammar because we can derive abc string by two different substitution methods as follows;
B,C)-->
Push down automata for the given language is as follows and tracing of given strings also as follows;
Here I showed that abc string is accepted by PDA because in abc no.of a's=no.of b's
in the string abbccc either no.of a's!=no.of b's or no.of b's != no.of c's so which is not accepted by the given language.
D)-->
E)-->
Construction of CNF for the given grammar is long time taken process and i did not have that much of time to solve this last question but I can show you what will do for converting given grammar into CNF;
Process for converting grammar to cnf :
--> Eliminate start symbol from RHS.
-->Eliminate null, unit and useless productions.
--> Eliminate terminals from RHS if they exist with other terminals or non-terminals. e.g,; production rule X->xY can be decomposed as:
--> Eliminate RHS with more than two non-terminals.
But I finally solved CNF for the given grammar as follows
I think it is right .if I did any mistakes please for give me.
Thankyou :)
Q1: Given the below language and context free gramma:, a. Show that the grammar is ambiguous...
Given the following ambiguous context free grammar (3x20) 1. (a) Explain why the grammar is ambiguous (b) Find an equivalent unambiguous context-free grammar. (c) Give the unique leftmost derivation and derivation tree for the string s generated from the unambiguous grammar above. 2. Construct non-deterministic pushdown automata to accept the following language (20) 3. Convert the following CFG into an cquivalent CFG in Chomsky Normal Form (CNF) (20)-
Give a context free grammar for the language L where L = {a"bam I n>:O and there exists k>-o such that m=2"k+n) 3. Give a nondeterministic pushdown automata that recognizes the set of strings in L from question 3 above. Acceptance should be by accept state. 4. 5 Give a context-free grammar for the set (abc il j or j -k) ie, the set of strings of a's followed by b's followed by c's, such that there are either a...
1. Give a context-free grammar for the set BAL of balanced strings of delimiters of three types (), and . For example, (OOis in BAL but [) is not. Give a nondeterministic pushdown automata that recognizes the set of strings in BAL as defined in problem 1 above. Acceptance should be by accept state. 2. Give a context free grammar for the language L where L-(a"b'am I n>-o and there exists k>-o such that m-2*ktn) 3. Give a nondeterministic pushdown...
The following shows a context-free Tammar on {0, 1}. Show that the grammar is ambiguous by generating 2 derivation sequences for word 00111. S > AS5 A → Al|0A101 The following is a context-free grammar on alphabet {a}. Use the string a +a- a to verify whether or not the grammar is ambiguous. AA+AA-AA The following is a gamar equivalent to the one shown above in problem (5). Is it ambiguous? Use a +a- a to verify it. A →...
Theory of Computation 7. Write down the Chomsky Normal Form for the context-free language de- fined by the productions: S bAļaB. A bAA laSla, and B aBB bS b, where S, A, B are nonterminal symbols and a, b are terminal symbol 8. For the context-free grammar Ģ -(X, T, R, S) with X (A, B. C, a, b), T a, b and productions R: SAB |BC, ABAa, BCClb,C AB la, check by applying the CYK Theorem whether the string...
consider the language L = { a^m b^n : m>2n}, give context free grammar and Nondeteministc pUSH DOWN AUTOMATON
5. Is the following language A context-free? You either show that A is context-free by giving a context-free grammar for A, or prove that A is not context-free language using the context-free language pumping lemma
1. (1 point) Which of the following is true? A. Every regular language is a context-free language. B. Every context-free language is a regular language. C. If a language is context-free, then there exists a pushdown automata to recognize it. D. The set of context free languages is strictly larger than the set of regular languages. E. Each of A,C, and D is true. 2. (1 point) The following diagram shows a context free grammar with start variable S and...
1. (1 point) Which of the following is true? A. Every regular language is a context-free language. B. Every context-free language is a regular language. C. If a language is context-free, then there exists a pushdown automata to recognize it. D. The set of context free languages is strictly larger than the set of regular languages. E. Each of A,C, and D is true. 2. (1 point) The following diagram shows a context free grammar with start variable S and...