C Compiler in PHP
This project supports following things as of now
- Functions with return type of 'int' only
- printf functions
- return statements are ignored
- preprocessor directives are ignored
example.c
#include <stdio.h>
int hello() {
printf("Hellooooo.....");
return 0;
}
int foo() {
printf("Foo, Bar");
return 0;
}
int main() {
printf("Hello, World");
}
output.py
def hello():
print("Hellooooo.....")
hello()
def foo():
print("Foo, Bar")
foo()
def main():
print("Hello, World")
main()
- PHP 7+
- Python 3
php c.php example.c > output.py
python output.py