chore(build): 更新构建脚本和配置文件

- 修改justfile中的构建命令,将build-lexer重命名为build_lexer
- 添加count命令用于统计代码行数
- 更新docs命令依赖关系

feat(docs): 完善README文档内容

- 更新项目名称为Simple C Compiler,简化为`scc`
- 添加详细的构建说明,介绍cbuild构建工具
- 补充标准C语言文档链接
- 重新组织项目特点描述

refactor(tree_dump): 修复未使用的返回值警告

- 在tree_dump_pop_level函数中添加(void)强制转换
- 解决scc_vec_pop返回值未被使用的问题

chore(gitignore): 添加新的忽略文件类型

- 增加.dot和.svg文件类型的忽略规则
- 保持.gitignore文件结构清晰
This commit is contained in:
zzy
2026-01-30 14:18:07 +08:00
parent 135e874a76
commit c8bf98525d
4 changed files with 42 additions and 14 deletions

4
.gitignore vendored
View File

@@ -32,3 +32,7 @@ build
# external # external
external/ external/
# dot file and svg file
*.dot
*.svg

View File

@@ -1,15 +1,35 @@
# Simple Models C Compiler # Simple C Compiler
> Smaller Compiler(SMCC) > `scc`
This is a simple C compiler that generates executable code from a simple c99 sub programming language. The language supports basic operations such as arithmetic, logical, conditional statements and if else while for switch case statements and function calls and system calls. 这是一个简单的C语言编译器可以从C99子集编程语言生成可执行代码。该语言支持基本操作如算术运算、逻辑运算、条件语句if/else)、循环语句(while/for)、分支语句(switch/case、函数调用以及内联汇编调用asm
## Features ## Builder
- 隔离标准库 该编译器使用`cbuild` 构建,设计思路来源于`rust`的构建工具`cargo`,以默认行为代替掉`make``cmake`等构建工具。
- 轻量化 > 由于整个项目除了测试代码,完全没有任何依赖,真正做到`0依赖`,所以无需复杂的依赖管理
TODO 未来构建工具本身也会使用c或者lua等可轻松自举的系统重构
- 模块化 ### [cbuild](./tools/cbuild/cbuild.py)
- 自举构建 常用命令:
- 构建项目: `cbuild build`
- 运行程序: `cbuild run`
- 运行测试: `cbuild test`
- 清理构建产物: `cbuild clean`
- 查看依赖树: `cbuild tree`
## 标准C语言文档链接
- [open-std](https://www.open-std.org/)
- [C - Project status and milestones](https://www.open-std.org/JTC1/SC22/WG14/www/projects#9899)
- [ISO/IEC 9899:1999](https://www.open-std.org/JTC1/SC22/WG14/www/docs/n1256.pdf)
## 项目特点
- **隔离标准库**: 不直接依赖标准库实现,提高可移植性
- **轻量化**: 专注于核心功能,减少冗余组件
- **模块化**: 采用模块化设计,易于扩展和维护
- **自举构建**: 支持通过自身编译器构建项目

View File

@@ -1,11 +1,15 @@
list: list:
just --list just --list
build-lexer: build_docs:
python build.py build -p libs/lexer
build-docs:
doxygen Doxyfile doxygen Doxyfile
docs: build-docs docs: build_docs
python -m http.server -d docs/html python -m http.server -d docs/html
count:
# you need download `tokei` it can download by cargo
tokei libs runtime src -e tests
build_lexer:
python ./tools/cbuild/cbuild.py --path libs/lexer build

View File

@@ -80,7 +80,7 @@ static inline void scc_tree_dump_push_level(scc_tree_dump_ctx_t *ctx,
// 弹出当前层级 // 弹出当前层级
static inline void scc_tree_dump_pop_level(scc_tree_dump_ctx_t *ctx) { static inline void scc_tree_dump_pop_level(scc_tree_dump_ctx_t *ctx) {
scc_vec_pop(ctx->stack); (void)scc_vec_pop(ctx->stack);
} }
// 获取当前层级深度 // 获取当前层级深度