Assignments are due at class time (8:30 AM) on the due date unless otherwise indicated. Assignments handed in after 8:30 AM on the due date will have 25% deducted from their scores. Assignments handed in the day after the due date will lose 50%. Assignments handed in after that may or may not be graded, depending on the grader's schedule, but will receive no credit in any case.
To submit programming assignments, use HSP.
Assigned 1/7/04, due 12:30PM Monday 1/12/04. First, obtain a copy of the code from pages 73-78 of your textbook, and test it out. (Note, by the way, that I have restricted access to these files to people coming from IP addresses 137.22.*.*. Fair use certainly allows us to use this code for our class, but it's not clear to me that I'm allowed to post the code on the Internet at large, even though that's where I got it.)
Now, modify the code to print out the value of the input expression rather than the postfix version of the expression. Thus, if I enter "3+4*5;", the output should be "23", not "3 4 5 * +". If I enter a non-numerical operand, print an error message.
There are many ways to achieve this task. One is to assemble the postfix expression in some sort of data structure, and then use a stack to evaluate the expression. I do not want you to use this method. Instead, I want you to seek a method that exploits the syntax-directed nature translation that is already built into the code. Is there a way to replace the printing operations in the existing code with arithmetic? If you make the various void functions return an int instead, can you compute the expression's value as you go? (Yes--but how?)
Have fun.
Assigned 1/9/04, due 1:10PM Friday, 1/16/04. Write a lexical analyzer for Java.
Assigned 1/21/04, due 12:30PM Monday, 1/26/04.
Assigned 1/28/04, due 1:10PM Friday, 2/6/04. Write an LR parser.
Assigned 2/13/04, due 12:30PM Wednesday, 2/18/04. Some problems from the book.
Assigned 2/13/04, due 1:10PM Friday, 2/20/04. A small bison exercise.
Assigned 2/13/04, due 12:30PM Wednesday, 2/25/04. Finish your parsers.