next up previous
Next: Level 2 Up: Projects on gcc Intermediate Previous: Level 0


Level 1

To the language in Level 0, add other arithmetic operators (-, $\star$, / and %) and boolean operators (==, !, $\vert\vert$, &&). Bitwise operators are not to be added. Unary `-' is also required as is the conditional (aka ternary) : ``?:''. Parentheses are to be used to specify the desired evaluation order. Boolean values are represented using integers as in usual C. Thus we ``complete'' the basic capabilities of the language.

A few example programs are as shown below. For brevity, we ignore the function headers and type declarations.

  1. (a*a - 2*a*b + b*b);
  2. ((b*b - 4*a*c) / 2*a);
  3. a = (b && (!(c || d)));



2006-01-08