1. From the winter 2005 midterm, a language for binary or trinary literals. A binary literal is
(0|1)+b2
and a trinary literal is
(0|1|2)b3
So for example 01110101b2 is a binary literal, 0110101b3 is a trinary literal and so is 01002201b3, but 010020101b2 is neither a binary literal nor a trinary literal. Given an NFA for this, we'll construct the DFA.
2. From the Spring 2006 midterm, a simplified quoted string problem. A quoted string (string literal) starts with a quotation mark and ends with a quotation mark. Within the string, we can have alphabetic characters. To put a quotation mark within a quoted string, we type two quotation marks together, like this:
"this is a ""string with a quoted substring"" up to here"
If we let 'a' stand for alphabetic characters and Q stand for a quotation mark, the regular expression might be something like
Q(a|(QQ))*Q
We'll use the subset construction to derive a DFA from the NFA.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment