Files
l-language/CHANGELOG.md
T

54 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Changelog
## 0.3.0 (2026-06-05)
### Added
- `for` 循环 + range: `for i in start..end { ... }` (parser 去糖为 let mut + while + assign)
- `..` range 运算符 (TOK_DOT_DOT)
- 浮点数 lexer 修复:`..` 不与 `.` 冲突
- sema 测试补全:let mut assign, immutable assign error, str type, str concat (9→21 tests)
- codegen 测试补全:while 循环 LLVMVerifyModule (7→9 tests)
- 集成测试:`10_for_range.l``11_for_step2.l`
### Known Issues
- LLVM 22 C API 不支持 mem2reg pass(需用 opt 工具优化 alloca
- str+str 运行时拼接使用 malloc(编译后程序存在泄漏,非编译器本身)
## 0.2.0 (2026-06-05)
### Added
- `let mut` 可变变量 + 赋值语句 (`x = expr;`)
- 可变性检查:对不可变变量赋值报编译错误
- 字符串类型 `str` + 双引号字面量 (`"Hello"`)
- 字符串拼接 `str + str` (malloc + strlen + memcpy 运行时实现)
- `print_str` 内置函数 (委托 printf)
- 复合赋值运算符:`+=` `-=` `*=` `/=`
- 集成测试:`06_mut_while.l` (while 循环修改变量)、`07_hello_str.l` (字符串输出)、`08_str_concat.l` (字符串拼接)
### Changed
- codegen malloc → arena 统一分配
- LLVM 目标初始化解耦为 `target.h/c` 独立模块
- 新增 `.codegraphignore`
### Fixed
- codegen.c 内存管理不一致 (malloc 混用 arena)
- str+str 运行时拼接返回左操作数的 bug
## 0.1.0 (2026-06-05)
### Added
- 词法分析器:手写状态机,40 种 Token 类型,支持 `//``/* */` 注释
- 语法分析器:Pratt 表达式解析(9 级优先级)+ 递归下降语句/函数解析
- AST:14 种节点类型,工厂函数模式创建
- 语义分析器:作用域链符号表 + 类型推断 + 类型检查
- LLVM IR 代码生成:全 AST 节点覆盖,内建 `print_i64` / `print_f64` / `print_bool`
- 驱动程序:命令行参数解析 + 编译流水线串联 + `--emit-ir` 调试模式
- Arena bump allocator (8MB)
- 错误报告:ANSI 红色高亮,文件名:行号:列号 格式
- 类型系统:`i64` / `f64` / `bool` / `void``let` 不可变变量,类型推断
- 控制流:`if` / `else``while` 循环,`return` 语句
- 函数:多参数、递归、可选返回类型标注
- 65 个单元测试 (词法 41 + 语法 15 + 语义 9)
- 5 个集成测试 (算术、分支、递归、斐波那契、浮点)
- CMake 构建系统,静态库 + 可执行文件 + 测试分离