Static Single Assignment Generator

Instructions

  • Enter a valid C program with only the main() function.
  • All the variables should be declared in the beginning.
  • Only if and while control flow statements are allowed.
  • Arbitrary control flow like goto, break and continue is not allowed.
  • Conditions in if/while cannot contain assignments. For example, if (a = b+c) {...} is not allowed.
  • Only scalar values are allowed. Arrays/pointers are not allowed.

Input Code

Output

					
					
				

Examples

Click on any of the snippets below to paste the text to the input area.


int main()
{
    int a, b, c;
    a = 10 + (5*2);
    b = 5;
    b = a * 4 / c;
    a = a+1-b;
    c = b-a;
    a = c;
    printf("%d", a + b + c);
    return 0;
}

int main()
{
    int a, b;
    if (a+b > 0) {
        a = a + 1;
        if (a <= b) {
            a = a + b;
        }
        else {
            a = a - b;
        }
    }
    b = a + b;
    return 0;
}

int main() {
    int a, b, i, j;
    a = 1;
    b = 2;
    i = 0;
    while (i <= 10) {
        if (a > b) {
            a = a + 1;
        }
        else {
            b = 5;
        }
    }
    j = a + b;
    return 0;
}

Created by Bikash Gogoi and Bhuvan Agrawal as a course project for CS6843 Program Analysis in Jan 2017

This project uses jison to generate parser. We have implemented the algorithm described in [BM94].