CS 3304 Homework Assignment 3

25 Points
Due: 02/05 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:

  1. Chapter 3, Problem 6

  2. Consider this grammar:

        <start>   --> <article> <adjs> <noun>
        <article> --> a
        <adjs>    --> 
                    | simple
                    | <adjs> , <adjs>
        <noun>    --> problem
    
    1. Prove that this grammar is ambiguous.

    2. What key feature of the grammar itself should tip you off that it is ambiguous?

  3. 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. C while
    2. C for
    3. C switch