Convert the following grammar G over Σ = {a, b} into Chomsky normal form. Note that G already satisfies the conditions on the start symbol S, λ-rules, useless symbols, and chain rules. Show your steps clearly.
S → bT
T → aAA | AbAT
A → aT | bT | a
## If all the production rules of given grammar G satisfies any one of the following rules, then the given grammar is in Chomsky Normal Form.
Rule 1 - A non terminal generating a terminal.
(Example A --> a)
Rule 2 - A non terminal generating two non
terminals ( Example T--> AA)
Rule 3 - ε (epsilon) generated by start symbol
S.
Note = There can be more than one Chomsky normal form for a given grammar.
The grammar G given in above question is ,
S → bT
T → aAA | AbAT
A → aT | bT | a
# Following are the steps to convert above grammar to CNF ( Chomsky Normal Form) ,
Step 1
= We have to eliminate start symbol S from RHS. Since there is no
start symbol S on RHS, this step is excecuted successfully.
Step 2
= We have to eliminate NULL, unit and useless productions. SInce
there are no such productions this step is executed
successfully.
Step 3
= We have to eliminate terminals from RHS if they exist with other
terminals or non-terminals. So,
S --> BT
T --> CAA | ABAT
A --> CT | BT | C
B --> b (NEW PRODUCTION ADDED)
C --> a (NEW PRODUCTION ADDED)
Step 4
= RHS with more than two non-terminals are removed. So,
S--> BT
T --> CD | EF
D --> AA (NEW PRODUCTION ADDED)
E --> AB (NEW PRODUCTION ADDED)
F --> AT (NEW PRODUCTION
ADDED)
A --> CT | BT | C
B --> b
C --> a
In the above generated grammar we see the is unit production
formation ( A --> C , C --> a)
Let us remove (as mentioned in step 2) as
following,
S--> BT
T --> CD | EF
D --> AA
E --> AB
F --> AT
A --> CT | BT | a
B --> b
C --> a
The above grammar seems to follow all the 3 rules described at the starting of this solution to form a Chomsky Normal Form. Hence it is our final answer.
----------------------------------
# HENCE the CNF of given grammar G is following
,
S--> BT
T --> CD | EF
D --> AA
E --> AB
F --> AT
A --> CT | BT | a
B --> b
C --> a
----------------------------------
Convert the following grammar G over Σ = {a, b} into Chomsky normal form. Note that...
5. (10 points) Convert the following grammar G over Σ-{a, b} into Chomsky normal form. Note that G already satisfies the conditions on the start symbol S, A-rules, useless symbols, and chain rules. Show your steps clearly. 5. (10 points) Convert the following grammar G over Σ-{a, b} into Chomsky normal form. Note that G already satisfies the conditions on the start symbol S, A-rules, useless symbols, and chain rules. Show your steps clearly.
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...
2. Convert the following grammar to Chomsky Normal Form (CNF). R is the start symbol and the lower case letters are terminals. The upper case letters are variables/non-terminals. R->XRXS S->a TbbTa T->XTXI X. € X->ab
2.) Convert the following grammar to Chomsky Normal Form ( please note that ‘lam’ refers to epsilon / lambda ) A -> BAB | B | lam B -> 00 | lam
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 following context free grammar G to Chomsky normal form. G:S → AB A → aAb|B2 B → BA2
4. Convert the following grammar to Chomsky Normal Form: SabAB A ABC B BA|A|
When is the grammar said to be in Chomsky Normal Form (CNF). Convert the given grammar to CNF by showing step by step. { S->VP VP->Verb VP-> Verb VP NP->N NP PP Verb->climb|lift|read N-> Tom | apple}
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
Consider the grammar provided below: S → AB | aB A → aab | Λ B → bbA Question: Showing all the steps convert the above grammar to Chomsky Normal Form (CNF)