0% found this document useful (0 votes)
38 views4 pages

CFG Task FAF-192

The document contains 17 variants that present context-free grammars in Chomsky Normal Form and then convert them to Greibach Normal Form. Each variant follows the same structure: 1. A context-free grammar in Chomsky Normal Form is given. 2. The grammar is converted to Greibach Normal Form by introducing additional nonterminals to satisfy the condition that all productions must be of the form A → aB, where a is a terminal and B is a string of terminals and nonterminals.

Uploaded by

Antonela Malii
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views4 pages

CFG Task FAF-192

The document contains 17 variants that present context-free grammars in Chomsky Normal Form and then convert them to Greibach Normal Form. Each variant follows the same structure: 1. A context-free grammar in Chomsky Normal Form is given. 2. The grammar is converted to Greibach Normal Form by introducing additional nonterminals to satisfy the condition that all productions must be of the form A → aB, where a is a terminal and B is a string of terminals and nonterminals.

Uploaded by

Antonela Malii
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

FAF-192

Varianta 1
1. Present the Context Free Grammar in Chomsky Normal Form
G = (VN,VT, P, S), VN= {S,A,B}, VT = {a,b}
P= {1. S→ a B 2. S→ b A 3. A→ B 4. A→ a S
5. A→ A b a B 6. B→ aA 7. B→ b S 8. B→ ε }
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → C A 2. C → A B 3. A → C 4. A → a 5. B → b }.
____________________________________________________________________________________________
Varianta 2
1. Present the Context Free Grammar in Chomsky Normal Form
G = (VN,VT, P, S), VN= {S,A,B}, VT = {a,b}
P= {1. S → a B 2. S → b A 3. A → aB 4. A → A S
5. A → b B A B 6. A → ε 7. B → b 8. B → A }
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → b C 2. B → C A 3. A → a 4. C → B 6. C → b }.
___________________________________________________________________________________________________
Varianta 3
1. Present the Context Free Grammar in Chomsky Normal Form
G=(VN, VT, P, S), VN={S, A, B}, VT={a, b}
P={1. S → aA 2. S →aB 3. A →B 4. A →aS
5. A → a 6. B →AbB 7. B → BS 8. B → }
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → A C 2. C → b A 3. A → S 4. A → b 5. B → A 6. B → a }.

Varianta 4
1. Present the Context Free Grammar in Chomsky Normal Form
G = (VN,VT, P, S), VN= {S, L, A, I}, VT = {a,b}
P= { 1. S→ La 2. L→ Aa I 3. L→ I 4. L→ L a A
5. L→ L b I 6. A→ a I b 7. I→ b 8. I→ ε }.
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → aC 2. C → BA 3. C → a 4. B → A 5. A → b 6. A → BA }.
_____________________________________________________________________________________________

Varianta 5
1. Present the Context Free Grammar in Chomsky Normal Form
G = (VN, VT, P, S), VN= {S,A,B}, VT = {a,b}
P= {1. S → a B 2. S → A B 3. A → a 4. A → a S
5. A → A B A B 6. B → A 7. B → b S 8. B → ε}
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → b A 2. A → B C 3. B → b 4. B → A 5. C →B 6. C → a }.
____________________________________________________________________________________________
Varianta 6
1. Present the Context Free Grammar in Chomsky Normal Form
G = (VN,VT, P, S), VN= {S,A,B}, VT = {a,b}
P= {1. S → a B 2. S → b a A 3. A→ a 4. A→ a S
5. A→ b A a B 6. B→ A 7. B→ B S 8. B → ε }.
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → B C 2. C → B B 3. C → a 4. A → b 5. B → C A }.
____________________________________________________________________________________________
Varianta 7
1. Present the Context Free Grammar in Chomsky Normal Form
G=(VN, VT, P, S), VN={S, A, B, C}, VT={a, b}
P={1. S→aB 2. S→AC 3. A→a 4. A→ASC
5. A→BC 6. B→b 7. B→bS 8. C→ 9. C → BA}
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → A C 2. C → a 3. B → a A 4. B → B C 5. A → b 6. A → S B }.
____________________________________________________________________________________
Varianta 8
1. Present the Context Free Grammar in Chomsky Normal Form
G=(VN, VT, P, S), VN={S, A, B}, VT={a, b}
P={1. S → A 2. S →aB 3. A →bAa 4. A →aS
5. A → a 6. B→AbB 7. B→BS 8. B → }
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → a A 2. A → b 3. A → B A 4. B → C 5. C → a 6. C → B S }.
___________________________________________________________________________________________________
Varianta 9
1. Present the Context Free Grammar in Chomsky Normal Form
G=(VN, VT, P, S), VN={S, A, B, D}, VT={a, b}
P={1. S →aB 2. S → DA 3. A → a 4. A → BD
5. A →bDAB6. B → b 7. B → BA 8. D → 9. D → BA}
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → b A 2. A → S C 3. B → A 4. A → a 5. A → B C 6. C → b }.

Varianta 10
1. Present the Context Free Grammar in Chomsky Normal Form
G = (VN,VT, P, S), VN= {S,A,B}, VT = {a,b}
P= {1. S→ a B 2. S→ B A 3. A→ a 4. A→ b B
5. A→ A a b B 6. B→ ε 7. B→ b S 8. B→ a A B A }
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → b B 2. A → B A 3. B → A C 4. A → B 5. A → b 6. C → a }.
__________________________________________________________________________________________
Varianta 11
1. Present the Context Free Grammar in Chomsky Normal Form
G = (VN,VT, P, S), VN= {S,A,B}, VT = {a,b}
P= {1. S→ a B 2. S→ b A 3. A→ B S 4. A→ a S
5. A→ A b a B 6. B→ A 7. B→ b S 8. B→ ε }
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → C A 2. C → A B 3. A → C 4. A → a 5. B → b }.
____________________________________________________________________________________________
Varianta 12
1. Present the Context Free Grammar in Chomsky Normal Form
G = (VN,VT, P, S), VN= {S,A,B}, VT = {a,b}
P= {1. S → a B 2. S → b A 3. A → B 4. A → A S
5. A → b B A B 6. A → ε 7. B → b 8. B → b S }
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → b C 2. B → C A 3. A → a
4. C → B 6. C → b }.
____________________________________________________________________________________________________
Varianta 13
1. Present the Context Free Grammar in Chomsky Normal Form
G=(VN, VT, P, S), VN={S, A, B}, VT={a, b}
P={1. S → A 2. S →aB 3. A →bAa 4. A →aS
5. A → a 6. B →AbB 7. B → BS 8. B → }
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → A C 2. C → b A 3. A → S 4. A → b 5. B → A 6. B → a }.

Varianta 14
1. Present the Context Free Grammar in Chomsky Normal Form
G = (VN,VT, P, S), VN= {S, L, A, I}, VT = {a,b}
P= { 1. S→ L 2. L→ A I 3. L→ a A 4. L→ L a A
5. L→ L b I 6. A→ a I b 7. I→ b 8. I→ ε }.
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → aC 2. C → BA 3. C → a 4. B → A 5. A → b 6. A → BA }.
Varianta 15
1. Present the Context Free Grammar in Chomsky Normal Form
G = (VN, VT, P, S), VN= {S,A,B}, VT = {a,b}
P= {1. S → a B 2. S → A B 3. A → a 4. A → a S
5. A → A B A B 6. B → A 7. B → b S 8. B → ε}
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → b A 2. A → B C 3. B → b 4. B → A 5. C →B 6. C → a }.
____________________________________________________________________________________________
Varianta 16
1. Present the Context Free Grammar in Chomsky Normal Form
G = (VN,VT, P, S), VN= {S,A,B}, VT = {a,b}
P= {1. S → a B 2. S → b a A 3. A→ a 4. A→ a S
5. A→ b A a B 6. B→ A 7. B→ B S 8. B → ε }.
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → B C 2. C → B B 3. C → a 4. A → b 5. B → C A }.
____________________________________________________________________________________________________
Varianta 17
1. Present the Context Free Grammar in Chomsky Normal Form
G=(VN, VT, P, S), VN={S, A, B, C}, VT={a, b}
P={1. S→aB 2. S→AC 3. A→a 4. A→ASC
5. A→BC 6. B→b 7. B→bS 8. C→ 9. C → BA}
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → A C 2. C → a 3. B → a A 4. B → B C 5. A → b 6. A → S B }.
__________________________________________________________________________________________
Varianta 18
1. Present the Context Free Grammar in Chomsky Normal Form
G=(VN, VT, P, S), VN={S, A, B}, VT={a, b}
P={1. S → A 2. S →aB 3. A →bAa 4. A →aS
5. A → a 6. B→AbB 7. B→BS 8. B → }
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → a A 2. A → b 3. A → B A 4. B → C 5. C → a 6. C → B S }.
____________________________________________________________________________________________
Varianta 19
1. Present the Context Free Grammar in Chomsky Normal Form
G=(VN, VT, P, S), VN={S, A, B, D}, VT={a, b}
P={1. S →aB 2. S → DA 3. A → a 4. A → BD
5. A →bDAB 6. B → b 7. B → BA 8. D → 9. D → BA}
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → b A 2. A → S C 3. B → A 4. A → a 5. A → B C 6. C → b }.
____________________________________________________________________________________________

Varianta 20
1. Present the Context Free Grammar in Chomsky Normal Form
G = (VN,VT, P, S), VN= {S,A,B}, VT = {a,b}
P= {1. S→ a B 2. S→ B A 3. A→ a 4. A→ b B
5. A→ A a b B 6. B→ ε 7. B→ b S 8. B→ a A B A }
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → b B 2. A → B A 3. B → A C 4. A → B 5. A → b 6. C → a }.
____________________________________________________________________________________________________
Varianta 21
1. Present the Context Free Grammar in Chomsky Normal Form
G = (VN,VT, P, S), VN= {S,A,B}, VT = {a,b}
P= {1. S→ a B 2. S→ b A 3. A→ B S 4. A→ a S
5. A→ A b a B 6. B→ A 7. B→ b S 8. B→ ε }
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → C A 2. C → A B 3. A → C 4. A → a 5. B → b }.
____________________________________________________________________________________________
Varianta 22
1. Present the Context Free Grammar in Chomsky Normal Form
G = (VN,VT, P, S), VN= {S,A,B}, VT = {a,b}
P= {1. S → a B 2. S → b A 3. A → B 4. A → A S
5. A → b B A B 6. A → ε 7. B → b 8. B → b S }
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → b C 2. B → C A 3. A → a 4. C → B 6. C → b }.
____________________________________________________________________________________________
Varianta 23
1. Present the Context Free Grammar in Chomsky Normal Form
G=(VN, VT, P, S), VN={S, A, B}, VT={a, b}
P={1. S → A 2. S →aB 3. A →bAa 4. A →aS
5. A → a 6. B →AbB 7. B → BS 8. B → }
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → A C 2. C → b A 3. A → S 4. A → b 5. B → A 6. B → a }.

Varianta 24
1. Present the Context Free Grammar in Chomsky Normal Form
G = (VN,VT, P, S), VN= {S, L, A, I}, VT = {a,b}
P= { 1. S→ L 2. L→ A I 3. L→ a A 4. L→ L a A
5. L→ L b I 6. A→ a I b 7. I→ b 8. I→ ε }.
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → aC 2. C → BA 3. C → a 4. B → A 5. A → b 6. A → BA }.

Varianta 25
1. Present the Context Free Grammar in Chomsky Normal Form
G = (VN, VT, P, S), VN= {S,A,B}, VT = {a,b}
P= {1. S → a B 2. S → A B 3. A → a 4. A → a S
5. A → A B A B 6. B → A 7. B → b S 8. B → ε}
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → b A 2. A → B C 3. B → b 4. B → A 5. C →B 6. C → a }.
____________________________________________________________________________________________
Varianta 26
1. Present the Context Free Grammar in Chomsky Normal Form
G = (VN,VT, P, S), VN= {S,A,B}, VT = {a,b}
P= {1. S → a B 2. S → b a A 3. A→ a 4. A→ a S
5. A→ b A a B 6. B→ A 7. B→ B S 8. B → ε }.
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → B C 2. C → B B 3. C → a 4. A → b 5. B → C A }.
____________________________________________________________________________________________
Varianta 27
1. Present the Context Free Grammar in Chomsky Normal Form
G=(VN, VT, P, S), VN={S, A, B, C}, VT={a, b}
P={1. S→aB 2. S→AC 3. A→a 4. A→ASC
5. A→BC 6. B→b 7. B→bS 8. C→ 9. C → BA}
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → A C 2. C → a 3. B → a A 4. B → B C 5. A → b 6. A → S B }.
__________________________________________________________________________________________
Varianta 28
1. Present the Context Free Grammar in Chomsky Normal Form
G=(VN, VT, P, S), VN={S, A, B}, VT={a, b}
P={1. S → A 2. S →aB 3. A →bAa 4. A →aS
5. A → a 6. B→AbB 7. B→BS 8. B → }
2. Convert the given grammar to the Greibach Normal Form
G=(VN, VT, P, S,), VN={S, A, B, C}, VT ={a, b},
P={ 1. S → a A 2. A → b 3. A → B A 4. B → C 5. C → a 6. C → B S }.

You might also like