CS230

Compiler Design


Project Assignment #5

Symbol Table and Code Generation

There are two parts to this assignment. The first is relatively simple; the second requires quite a bit of work. Options

  There is much room for extra work, all of which will be suitably rewarded. For example (in increasing order of difficulty):

Here are a couple of source programs that you can try your compilers on:
program monsterExpr (input, output);
 var a, b, c, d, e, f, g, h, x : integer;
begin
 a := 1; b := 2; c := 3;
 d := 4; e := 5; f := 6;
 g := 7; h := 8;
 x := 9;
 x := ((a + b + c + d + e + f + g + h)*(a - b + c - d + e - f + g - h)
      mod g)*(x*(a + b + c + d + e + f + g + h)
              *(a - b + c - d + e - f + g - h) div b)
           *x*(a + b*(a + b + c + d + e + f + g + h)
                  + c + d + e + f + g + h);
end.


program primeTester (input, output);
var x, divisor : integer;
  prime : boolean;
begin
  x := 121;
  divisor := 2;
  prime := true;
  while (divisor < x) and prime do
   if ((x mod divisor) = 0) then
     prime := false
   else
     divisor := divisor + 1
end.

Back to CS 230 Home Page