This commit is contained in:
lyc 2024-12-06 00:37:07 +08:00
parent 3d6ed0a5a9
commit ba56bec560
2 changed files with 47 additions and 1 deletions

View File

@ -6,11 +6,57 @@
- NASM version 2.16.01
- antlr complete & runtime Version: 4.9.3
- glog
# 执行
- `请使用C++17以上标准`
# 构建
```shell
mkdir build && cd build
cmake ..
make -j4
```
# 批量执行
```shell
bash test_all.sh
```
# 详细说明
- 可执行文件 `LiteGoCompiler`
- 用法
```shell
./LiteGoCompiler /path/to/gofile
```
- 所需库 `print.o` 负责向标准输出打印结果
- 源文件同级文件夹下生成中间产物
- out.asm 三地址中间代码
- out.o 二进制编译产物
- 目标可执行文件 out.bin
# 文件结构
```
.
├── antlr -------------------------- 存放 antlr jar 包和 runtime
│ └── antlr4-runtime
├── grammar ------------------------ 存放 Go 语言语法文件和 antlr 针对 Cpp 的解析结果
│ └── cpp
├── include ------------------------ 代码头文件
│ ├── Common
│ ├── ICG
│ │ └── StmtICG
│ ├── Public
│ └── TCG
│ └── SentenceTranslator
├── src ----------------------------- 源代码
│ ├── Common
│ ├── ICG
│ ├── Public
│ └── TCG
│ └── SentenceTranslator
└── test ---------------------------- 测试文件
```
# 代码架构
![code](./assest/code.jpg)

BIN
assest/code.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB