CS 3304 Homework Assignment 3

25 Points
Due: 09/18 at the start of class

Note: The following instructions are repeated from the Homework Dates/Guidelines page:

Your solutions for each homework assignment must be prepared with a word processor (e.g., LaTeX or Word), and are due at the beginning of class on the due date specified unless otherwise noted on the assignment itself.

Note that all homework problems taken from the text are in the Problem Sets. Do not turn in solutions to Review Questions by mistake!

Complete each of the following problems in the Chapter 3 Problem Set (p. 149-151 of the 5E text, 152-154 in 4E)::

  1. Using the virtual machine instructions given in Section 3.5.1.1 (in the 4th edition, Section 3.6.1.1), give an operational semantic definition of the following:
    1. Pascal for-downto
    2. Pascal if-then-else
    3. C switch
    [ This question is based on Chapter 3, Problem 12, parts b, d, and f; it is rephrased here because of the typographical error in part (b) of the 5th edition text book, which should read "Ada for". ]

  2. Chapter 3, Problem 14

  3. For the last problem in this homework assignment, complete the lexer/tokenizer for your program 1 assignment and include a complete source listing for a Pascal program that includes your tokenizer variables, data structures, and subprograms. The body of the main program should call your tokenizer repeatedly in a loop, printing out each individual token read from standard input on a separate line by itself on standard output.