Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yifengyou/write-a-C-interpreter
https://github.com/yifengyou/write-a-C-interpreter
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/yifengyou/write-a-C-interpreter
- Owner: yifengyou
- License: gpl-2.0
- Created: 2017-09-23T12:29:07.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-23T12:29:17.000Z (about 7 years ago)
- Last Synced: 2024-04-24T15:34:51.614Z (7 months ago)
- Language: C
- Size: 71.3 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- AwesomeInterpreter - write-a-C-interpreter
README
C interpreter that interpretes itself.
# How to Run the Code
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 (you may need the -m32 option on 64bit machines)
./xc hello.c
./xc -s hello.c./xc xc.c hello.c
./xc xc.c xc.c hello.c
```# About
This project is inspired by [c4](https://github.com/rswier/c4) and is largely
based on it.However, I rewrited them all to make it more understable 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.
1. [手把手教你构建 C 语言编译器(0)——前言](http://lotabout.me/2015/write-a-C-interpreter-0/)
2. [手把手教你构建 C 语言编译器(1)——设计](http://lotabout.me/2015/write-a-C-interpreter-1/)
3. [手把手教你构建 C 语言编译器(2)——虚拟机](http://lotabout.me/2015/write-a-C-interpreter-2/)
4. [手把手教你构建 C 语言编译器(3)——词法分析器](http://lotabout.me/2015/write-a-C-interpreter-3/)
4. [手把手教你构建 C 语言编译器(4)——递归下降](http://lotabout.me/2016/write-a-C-interpreter-4/)
5. [手把手教你构建 C 语言编译器(5)——变量定义](http://lotabout.me/2016/write-a-C-interpreter-5/)
6. [手把手教你构建 C 语言编译器(6)——函数定义](http://lotabout.me/2016/write-a-C-interpreter-6/)
7. [手把手教你构建 C 语言编译器(7)——语句](http://lotabout.me/2016/write-a-C-interpreter-7/)
8. [手把手教你构建 C 语言编译器(8)——表达式](http://lotabout.me/2016/write-a-C-interpreter-8/)
0. [手把手教你构建 C 语言编译器(9)——总结](http://lotabout.me/2016/write-a-C-interpreter-9/)# Resources
Further Reading:
- [Let's Build a Compiler](http://compilers.iecc.com/crenshaw/): An excellent
starting material for building compiler.Forks:
- [A fork that implement debugger for xc.c](https://github.com/descent/write-a-C-interpreter)
# Licence
The original code is licenced with GPL2, so this code will use the same
licence.