EECS 742

Static Analysis

Index
Blog

Project 2 Examples

Here are a few examples for testing Project 2. There is nothing magical or tricky about them. Feel free to modify as you see fit by adding parentheses and end. As a reminder you do not need to write a parser. Feel free to translate these examples directly into abstract syntax.

X := 1 ;
IF X = 3 THEN X:=1 ; Y:=4 ELSE X:=0 ENDIF
SKIP
Y := X ;
Z := Y ;
WHILE Y <= 10 DO
  WHILE Z <= 10 DO
    X := X+Z ;
    Z := Z+1 ;
  Y := Y+1 ;
SKIP ;
Y:=0;
IF X <= 10 THEN WHILE Y <= 10 DO Y:=Y+1; X:=X+Y
           ELSE X := 10
IF X <= 3 THEN IF Y <= 4 THEN Z:=X+Y
                         ELSE SKIP
          ELSE IF Y <= 4 THEN Z:=X*Y
                         ELSE Z:=1