CS 1622 – Homework 1
Due: Tuesday, February 10, 2015 at the start of
class
Please submit a typewritten document. I’d prefer you draw your finite state machines on the computer, but if this is a challenge, you may hand draw them neatly on the paper by hand.
1.) Write the following regular expressions:
a.) Binary numbers that are multiples of four.
b.) Valid C/Java integer in hexadecimal.
c.) A string literal with escape sequences
2.) Convert the following regular expression to an NFA (alphabet is {a,b}):
ba*bb?a
3.) Convert your NFA from question 2 into a DFA.
4.) Write a grammar that a logic solver may implement. The terminals are:
T, F, ^, v, ~, (, )
Make sure to express the precedence that ~ (not) is higher than ^ (and) is higher than v (or) in your grammar.
5.) Construct an LL(1) parse table for your grammar from 4. Show the First and Follow sets you generated.
6.) Show the action list for the input:
~T ^ (F v T)