2022春夏编译原理大程——面向Pascal语言的编译器设计
- main : 主分支
- visualization : 可视化分支
- src : 源码文件夹
- test : 测试代码文件夹
- report : 项目报告与可视化AST结果
- git checkout main : 切换到
main
分支 - git add .
- git commit -m "first commit to main"
- git push origin main
- git fetch origin main
4.23: First commit Lexer.
5.10: Finish Parser.
5.13: Finish AST.
5.20: Finish LLVM.
5.25: Finish visualization.
- g++
- llvm >= 12.0
- cmake >= 3.10
Usage
./opc test.pas
: Generate IR code and object code from test.pas to test.pas.ll and test.pas.o.lli test.pas.ll
: Generate an executable file from IR code test.pas.llclang++ -o main test.pas.o
: Generate an executable file(main) from object code test.pas.o
或者直接运行脚本,需要运行的pas文件写入脚本内
run.sh
-
sudo apt-get install graphviz
:安装相关依赖 -
dot -Kdot -Tpng test.pas.dot -o sample.png
:可以将test.pas.dot
文件生成可视化图片sample.png