Commit Graph

15 Commits

Author SHA1 Message Date
zzy
07a76d82f4 feat(lex_parser, pprocessor): rename identifier header check and add macro system
- Rename `scc_lex_parse_is_identifier_header` to `scc_lex_parse_is_identifier_prefix` for clarity and add a TODO comment
- Update lexer to use the renamed function for consistency
- Fix package and dependency names in `cbuild.toml` (`smcc_pprocesser` → `scc_pprocesser`, `smcc_lex_parser` → `lex_parser`)
- Introduce new macro system with header file `pp_macro.h` defining macro types, structures, and management functions
- Refactor preprocessor initialization and cleanup in `pprocessor.c` to use new macro table and stream handling
- Replace legacy `hashmap` with `scc_pp_macro_table_t` for macro storage
- Improve error handling and resource management in preprocessor lifecycle
2025-12-13 16:09:46 +08:00
zzy
874a58281f feat(lex_parser): rename functions and update header guard prefix
- Change header guard from `__SMCC_LEX_PARSER_H__` to `__SCC_LEX_PARSER_H__`
- Prefix all lexer functions with `scc_` (e.g., `lex_parse_char` → `scc_lex_parse_char`)
- Add new helper function `scc_lex_parse_is_identifier_header`
- Update references in source and test files to use new function names
- Replace `core_stream_eof` with `scc_stream_eof` for consistency
2025-12-13 14:06:13 +08:00
zzy
94d3f46fac refactor(lex_parser): replace core_pos_* functions with scc_pos_* equivalents
Update all position tracking calls in lex_parser.c to use the scc_pos_* function family (scc_pos_next, scc_pos_next_line) instead of the deprecated core_pos_* variants. This ensures consistency with the scc naming convention and prepares for future removal of the old core functions.
2025-12-12 21:33:51 +08:00
zzy
d88fa3b8d3 feat: rename core types to scc prefix for consistency
Updated type names from `core_*` to `scc_*` across lex_parser and stream modules to maintain naming consistency within the SCC codebase. This includes changes to function signatures and internal usage of types like `core_probe_stream_t`, `core_pos_t`, and `cstring_t` to their `scc_*` counterparts.
2025-12-11 13:00:29 +08:00
zzy
186602a301 feat(core): rename string and stream functions for clarity
- Rename `cstring_push` to `cstring_append_ch` and `cstring_push_cstr` to `cstring_append_cstr` for consistent naming with new `cstring_append` function
- Update all callers in lexer and tests to use new function names
- Rename stream `destroy` method to `drop` for consistency with resource management conventions
- Fix potential overflow in string capacity calculation by adjusting growth logic
2025-12-09 18:04:53 +08:00
zzy
36bff64a91 feat 重构stream流API并适配lex_parse和lexer 2025-12-08 23:04:11 +08:00
zzy
ed829bdc21 feat(cbuild): 重构依赖解析器并增强命令行功能
- 将 `resolved_deps` 重命名为 `deps` 并新增 `dep_map` 用于存储依赖关系
- 新增 `get_dependencies_of` 方法以获取指定包的直接依赖列表
- 实现递归打印依赖树的功能,优化 `tree` 命令展示效果
- 引入分层命令行参数解析,支持子命令及更多选项(如 --record、--args 等)
- 改进日志输出与构建模式提示信息,使其更准确反映当前构建状态
- 编译器类中增加命令记录机制,便于调试和回溯执行过程
2025-11-27 12:15:45 +08:00
zzy
871d031ceb feat(lex_parser): 初始化词法解析器模块
新增词法解析器库 `smcc_lex_parser`,包含基础的词法规则解析功能:
- 支持字符、字符串、数字、标识符的解析
- 支持跳过注释、空白符、行尾等辅助函数
- 提供对应的单元测试用例,覆盖各类合法与非法输入情况

该模块依赖 `libcore`,并被 `smcc_lex` 模块引用以支持更上层的词法分析逻辑。
2025-11-23 22:53:46 +08:00
zzy
fa5611dabd fix(log): 修复默认日志实例命名冲突并优化宏定义
将 `logger_root` 重命名为 `__default_logger_root` 以避免潜在的符号冲突,
同时简化日志宏定义逻辑,提升代码可读性与维护性。此外,为防止 clang-format
格式化影响日志宏的排版,添加了 clang-format 开关注释。

refactor(memory): 优化 memcmp 函数中的 switch-case 结构

在 `smcc_memcmp` 函数中为每个 case 添加 `/* fall through */` 注释,
明确表示故意穿透到下一个 case,提高代码意图的清晰度,并增强静态分析工具的兼容性。
2025-11-22 16:59:28 +08:00
zzy
63f6f13883 feat(cbuild): 重构构建系统并迁移至 tools/cbuild
将 `cbuild.py` 迁移至 `tools/cbuild/` 并进行大量功能增强。引入依赖解析器、支持颜色日志输出、
改进包配置默认值处理、完善构建目标识别与拓扑排序依赖管理。同时添加 `.gitignore` 和
`pyproject.toml` 以支持标准 Python 包结构,并更新 README 文档。

新增命令支持:tree(显示依赖树)、clean(带文件统计)、test(运行测试)等,
优化了 Windows 平台下的可执行文件扩展名处理逻辑。

移除了旧的 `wc.py` 行数统计脚本。
2025-11-22 15:08:49 +08:00
zzy
a3322f0d4c feat(runtime): 添加字符串和内存操作工具函数
- 在 `core_mem.h` 中新增 `smcc_strhash32`、`smcc_strlen` 和 `smcc_strcmp` 函数,
  提供 C 字符串的哈希、长度获取和比较功能
- 完善 `core_str.h` 中 `cstring_t` 结构体及相关操作函数的注释说明
- 更新 `core_str.h` 头文件保护宏命名,增强模块标识一致性
- 修改 `core_vec.h` 文件头部保护宏名称以匹配实际文件名

另外,在 lexer 测试运行代码中引入日志相关头文件并调整日志级别设置逻辑。
2025-11-21 17:52:42 +08:00
zzy
f29fd92fdf feat(core): 添加字符串长度计算函数并优化数据结构定义
- 在 `core_mem.h` 中新增 `smcc_strlen` 函数,用于计算字符串长度
- 调整 `VEC` 宏定义参数,移除冗余的 name 参数,增强结构体声明一致性
- 修改 `cstring_from_cstr` 返回值字段顺序,保持代码风格统一
- 在 `libcore.h` 中增加日志相关宏定义的保护判断,防止重复定义冲突
2025-11-20 22:26:49 +08:00
zzy
d1fafa830d format using clang-format to formate code 2025-11-20 17:55:08 +08:00
zzy
47b56d52f6 feat(core): 重构词法分析器流接口并迁移至 core 库
将 lexer_stream 抽象为 core_stream,统一运行时核心组件的输入流模型。
移除了旧的 `lexer_stream.h` 定义,并将其功能完整迁移至 `core_stream.h` 中。
更新了内存流实现以适配新的 core_stream 接口,并修复部分资源释放问题。
同时调整日志模块包含方式,增强模块间解耦能力。

此变更影响词法分析器对输入流的操作方式,所有涉及 stream 的类型与函数均已替换为 core 前缀版本。
测试用例同步更新并验证通过。
2025-11-20 14:17:03 +08:00
zzy
5c24f35c87 feat 新的运行时环境 2025-11-20 11:22:37 +08:00