Homework #1
Due June 19, at the beginning of class
Question one (18 points, 3 points each)
In the text, page 49, translate parts a, b, and c of exercise 2.1 to prefix and postfix notation.
Question two (22 points, 6, 7, 9)
Give context-free grammars describing syntax of each of the following:
-
Strings of even length over the set of terminals blank, tab and
newline
(Note 0 is even)
-
Java/C++-style variable names, ie. nonempty sequences of letters and digits
starting with a letter or an underscore.
-
Real numbers in which either the integer part or the fractional part can
be empty, but not both. Thus, the grammar must allow 31., 3.1,
and .13, but not a decimal point by itself.
Question three (25 points)
In the text, page 51, exercise 2.12
Question four (25 points, 5, 10, 10)
In the text, page 51, exercise 2.14
Question five (10 points)
In the text, page 51, exercise 2.15 - part a only