https://github.com/tangruize/compiler
Compiler principles lab
https://github.com/tangruize/compiler
c-minus-minus c-plus-plus compiler
Last synced: 3 months ago
JSON representation
Compiler principles lab
- Host: GitHub
- URL: https://github.com/tangruize/compiler
- Owner: tangruize
- Created: 2018-01-08T15:16:41.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-15T07:57:57.000Z (over 7 years ago)
- Last Synced: 2025-01-07T20:42:07.654Z (5 months ago)
- Topics: c-minus-minus, c-plus-plus, compiler
- Language: Python
- Size: 124 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Compiler
Compiler principles lab# 依赖关系
cmake, gcc, g++, flex, bison, spim
(若提示cmake版本低, 通常修改CMakeLists.txt文件第一行为你的版本即可)
```
sudo apt install cmake gcc g++ flex bison spim
```# 编译
```
cd build
cmake ..
make
```
将产生 CompilerLab1, CompilerLab2, CompilerLab3, CompilerLab4.
CompilerLab1~3 是阶段性成果. CompilerLab4 包含了其他是三个的所有功能.# 运行
```
./CompilerLab4 ../testcase/lab4_more/E-2.3.cmm output.s
spim -file output.s
```
第一条命令将输出 output.s, output.s.ir, output.s.syntax 文件.
分别为目标代码, 中间代码和抽象语法树. 若发生错误则不会生成.
第二条命令运行生成的结果.