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:
void main()
{
 int a, b, c, d, e, f, g, h, x;
 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) % g)
      *(x*(a + b + c + d + e + f + g + h)
         *(a - b + c - d + e - f + g - h) / b)
         *x*(a + b*(a + b + c + d + e + f + g + h)
               + c + d + e + f + g + h);
 printf(x);
}


void main ()
{
  int x, divisor;
  bool prime;
  x = 121;
  divisor = 2;
  prime = 1;
  while ((divisor < x) && prime)
   if (!(x % divisor))
     prime = 0;
   else
     divisor = divisor + 1;
  printf(prime);
}

Back to CS 230 Home Page