Build a Context-Free Grammar in Chomsky Normal Form that implements the following language features: (a) an integer-based data type, (b) a value-type variable declaration of an integer data type, and (c) an assignment expression that allows for two integer-based variables to be added together. Examples: (a) define an integer data type (b) int a; (c) a = 2 + 3;
Context Free Grammer
S->ABA
A->a|b
B->+
The conversion to Chomsky Normal Form has four main steps:
1. Get rid of all ε productions.
2. Get rid of all productions where RHS is one variable.
3. Replace every production that is too long by shorter productions.
4. Move all terminals to productions where RHS is one terminal.
Chomsky Normal Form
S0 -> AC
S -> AC
A -> a | b
B -> +
C -> BA
Build a Context-Free Grammar in Chomsky Normal Form that implements the following language features: (a) an...
Convert the context free grammar to an equivalent grammar in Chomsky normal form: (show your work) S → AxAyA | BC A → BB | a B → bd | ε C → SC | c
Convert the following context free grammar G to Chomsky normal form. G:S → AB A → aAb|B2 B → BA2
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...
Write a grammar in Chomsky Normal Form whose language is {w € {a,b}* | w = a ba?bk, j, k >0}. Make sure your grammar is designed with roles for the variables to make the language derived clear.
Q1: Given the below language and context free gramma:, a. Show that the grammar is ambiguous using the string ( abc) by using substitutions. b. Then design a push down automata that recognizes the language. C. Then show the tracing of (abc, abbccc) using the push down automata. d. Then Show which two simple languages create the greaterlanguage. Give set builder notation for each language. e. Then produce Chomsky normal form for the grammar. The following context-free language is inherently...
QUESTION 3 Convert the context Free Grammar below to Chomsky Normal Form. Use the tech- nique shown on the textbook, show every step while explaining what you did. SaPa aQbR P + aQbQa | S | Sb Q+QE RRE Attach File Browse My Computer Browse Content Collection
1)Convert the following context free grammar to Chomsky Normal Form S → a X | Yb X → S | λ Y → b Y | λ 2)Some languages distinguish between uppercase and lowercase in identifiers. What are the pros and cons of this design decision? 3)Use the pumping lemma to prove that the following languages are not regular. (The alphabet is Σ = {a, b}.) a) L = {an b1 ak: k >= n+ l} b) L = {ww:...
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)-
TRUE OR FALSE? (Note: E = belongs to) 1. A context-free grammar G is in Chomsky normal form. Then G is not recursive. 2. Let G be an arbitrary context-free grammar. uAv =>* u'A'v' , where u, v, u' and v' E V* and A E (V - Eps), then L(G) is infinite. 3. {ww : w E {a, b}*} is accepted by some NDPDA with exactly two states