Write a simple interpreter of C. Inspired by c4 and largely based on it.
Write a simple interpreter of C. Inspired by c4 and largely based on it.
C interpreter that interprets itself.
File xc.c is the original one and xc-tutor.c is the one that I make for
the tutorial step by step.
gcc -o xc xc.c
./xc hello.c
./xc -s hello.c
./xc xc.c hello.c
./xc xc.c xc.c hello.c
This project is inspired by c4 and is largely based on it.
However, I rewrote them all to make it more understandable and help myself to understand it.
Despite the complexity we saw in books about compiler design, writing one is not that hard. You don't need that much theory though they will help for better understanding the logic behind the code.
Also I write a series of article about how this compiler is built under directory tutorial/en.
There is also a chinese version in my blog.
Further Reading:
Forks:
The original code is licenced with GPL2, so this code will use the same licence.
No open issues yet, or sync has not completed.