A toy C Compiler implemented by Rust.
# first time
make
# build and testing
make build
make e2e
int main() {
return 0;
}
int main() {
return 42;
}
int main() {
return 5 + 20 - 4;
}
int main() {
return 5 + 6 * 7;
}
int main() {
return 5 * (9 - 6);
}
int main() {
return (3 + 5) / 2;
}
int main() {
return 0 < 1;
}
int main() {
return 1 >= 0;
}
int main() {
return 0 <= 1;
}
int main() {
return 0 != 1;
}
int main() {
return 42 == 42;
}
int main() {
int a = 2;
return a + 2;
}
int main() {
int a = 10;
a = a + 2;
return a;
}
int main() {
int x = 2;
int y = 5;
return x + y;
}
int main() {
int x = 3;
int *y = &x;
return *y;
}
int main() {
int x = 0;
int *y = &x;
*y = 3;
return x;
}
int main() {
int x = 100;
int a = 200;
int *p = &x;
p = p + 1;
return *p;
}
int main() {
int x = 100;
int a = 200;
int *p = &a;
p = p - 1;
return *p;
}
int main() {
int a[2];
*a = 1;
return *a;
}
int main() {
int a[2];
*a = 1;
return a[0];
}
int main() {
int a[2];
a[0] = 1;
a[1] = 2;
return a[1];
}
int main() {
int a[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
return a[9];
}
int main() {
char *a = "ABC";
return *a;
}
int main() {
char *a = "ABCDEF";
return a[5];
}
int main() {
int foo = 4;
int z = 5;
if (foo / 2 == 2) z = 50;
return foo + z;
}
int main() {
int foo = 100;
int z;
if (foo / 2 == 50) {
z = 50;
} else {
z = 100;
}
return foo + z;
}
int main() {
int i = 0;
while (i < 10) {
i = i + 1
};
return i;
}
int main() {
int i = 0;
for (i = 1; i < 10; i = i + 2) {
i = i - 1;
}
return i;
}
int foo(int i) {
return i;
}
int main() {
int a = foo(10);
return 10;
}
int main() {
int x = 0;
return sizeof(x);
}
int main() {
/*
* comment
*/
return 0;
}
int main() {
// comment
return 0;
}