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
Chomsky Normal Form format
S0 -> epsilon
NT -> NT NT
NT -> T
where NT = Non terminal and T = terminal
S0 -> S
S -> AxAyA | BC
A -> BB | a
B -> bd | ε
C -> SC | c
Removing B -> ε
S0 -> S
S -> AxAyA | BC | C
A -> BB | a | ε | B
B -> bd
C -> SC | c
Removing A -> ε
S0 -> S
S -> AxAyA | BC | AxAy | AxyA | xAyA | xy | Axy | xAy | xyA |
C
A -> BB | a | B
B -> bd
C -> SC | c
Remove Unit productions
S0 -> AxAyA | BC | AxAy | AxyA | xAyA | xy | Axy | xAy | xyA
| SC | c
S -> AxAyA | BC | AxAy | AxyA | xAyA | xy | Axy | xAy | xyA | SC
| c
A -> BB | a | bd
B -> bd
C -> SC | c
S0 -> AXAYA | BC | AXAY | AXYA | XAYA | XY | AXY | XAY | XYA
| SC | c
S -> AXAYA | BC | AXAY | AXYA | XAYA | XY | AXY | XAY | XYA | SC
| c
A -> BB | a | ED
B -> ED
C -> SC | c
X -> x
Y -> y
E -> b
D -> d
S0 -> FI | BC | FG | FH | XI | XY | FY | XG | XH | SC |
c
S -> FI | BC | FG | FH | XI | XY | FY | XG | XH | SC | c
A -> BB | a | ED
B -> ED
C -> SC | c
X -> x
Y -> y
E -> b
D -> d
F -> AX
G -> AY
H -> YA
I -> GA
--------------------------------------
Hit the thumbs up if you are fine with the answer. Happy
Learning!
Convert the context free grammar to an equivalent grammar in Chomsky normal form: (show your work)...
In each of the following, find a Chomsky Normal Form (CNF) grammar equivalent to the given context-free grammar (CFG). 1. SaA Sab A+ ab | BA ASD BaS b 2. SAIC A → AaB AaC | B | a B Bb Cb (→ cclc 3. S → SabA; AAA bc | Bc; B → Aab | BS a
Convert the following context free grammar G to Chomsky normal form. G:S → AB A → aAb|B2 B → BA2
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
Convert the following grammar into Chomsky Normal Form
(CNF):
S → aS | A
| bS
A → aA |
bBa | aAa
B → bb |
bBb
Note: you need to first simplify the grammar ( remove any
λ -
productions, unit productions, and useless productions), and then
convert the simplified grammar to CNF.
Convert the following grammar into Chomsky Normal Form (CNF): SaSAS A → AbBa| aAa B+bb | bBb Note: you need to first simplify the grammar...
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:...
Convert the grammar which given below into Chomsky normal form R → XRX | S S → aTb | bTa T → XTX | X | ε X → a | b Automata and Computation
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;
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...
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)-
Question 2 (20%) Convert the following CFG into an equivalent CFG in Chomsky normal form using the procedure discussed in the textbook. Show every step in the conversion. A → ABC A → a | ε B → b C → c