Compiler Design

Homework Assignment 1 (10 points)

Due September 28, 2004

- Consider a definition of strings as follows:
- A string starts with a single quote character (')
- A string ends with a single quote character (')
- A string may contain letters, digits, spaces, tabs and escaped quote characters
- A quote character is escaped by preceding it with a slash character

- Draw a DFA that recognizes this language
- Write a regular expression that defines this language
- Convert your regular expression into an NFA using the algorithm that was discussed in class
- Run the algorithm we discussed in class to convert your NFA to a DFA

- Some programming languages allow integer constants to be written
in other bases (e.g., base 8, 10, 16). Consider a language of
integer constants where base 8 numbers start with a 0 and may contain
digits from 0 to 7, base 10 integer constants start with any digit
other than zero and can include digits from 0 to 9, and base 16
numbers start with an X and can include digits 0 through 9 as well
as letters A through F -- 10 (A), 11 (B), 12 (C), 13 (D), 14 (E),
15 (F).
- Draw a DFA that recognizes this language
- Write a regular expression that defines this language