Some grammar formalisms exercises


Problem 1. Here is a grammar over the alphabet $\Sigma = {a,b}$:

See if you can answer these questions:


Problem 2. Here is a grammar over the alphabet $\Sigma = {a,b,c}$:


Problem 3. Here is a grammar over the alphabet $\Sigma = {a,b}$:


Problem 4. Here is a grammar over the alphabet $\Sigma = {a,b,c}$:


Problem 5. Here is a grammar over the alphabet $\Sigma = {a,b}$:

This grammar is not regular because one of the rules is a type of rule that is not allowed for regular grammars. (Which rule?)

However, the language generated by this grammar, that is, all of the possible strings produced by these rules, is actually regular! That means it's possible to write a regular grammar (with different rules) that generates the same language, even though its rules are different.


Problem 6. Here are some regular expressions. Can you figure out a DFA that accepts each one?


Problem 7. Here is a DFA:

DFA example 1


go to homepage
The posts on this website are licensed under CC-by-NC 4.0.