Compiler Construction
Fall 1998
Assignment II

Due : March 1.

1. Using the Ada grammar as specified in, write the parse tree for
the following:

     procedure incr (x : in out vec) is
        count : float;
         for J in vec'range loop
            vec (J) := vec (J) + 1;
         end loop;
         count := float (vec'length (1));
     end incr;

2. From text: problems 4.1 (p. 267), 4.5, and 4.11 (part a only).

3. Write the grammar for logical expressions in C++ or Java (it's ok to look
it up). Include the conditional operator ("?"). Write the parse tree for
some expression with four or more operators.