118k views
3 votes
Design CFGs for the following languages. Follow the format presented in the class for specifying CFGs.

User Janvb
by
7.5k points

1 Answer

3 votes

Final answer:

Here are CFGs for English, French, and German languages.

Step-by-step explanation:

Here are three CFGs for different languages:

CFG for English:

S -> NP VP
NP -> Det Noun
VP -> V NP
Det -> 'the' | 'a'
Noun -> 'cat' | 'dog'
V -> 'chased' | 'ate'

CFG for French:

S -> NP VP
NP -> Det Noun
VP -> V NP
Det -> 'le' | 'un'
Noun -> 'chien' | 'chat'
V -> 'courait' | 'mange'

CFG for German:

S -> NP VP
NP -> Det Noun
VP -> V NP
Det -> 'der' | 'ein'
Noun -> 'Hund' | 'Katze'
V -> 'rannte' | 'aß'

User Cronos
by
7.5k points