b390d390f3
- lexer: TOK_STRUCT, TOK_DOT 关键字和运算符
- ast: AST_STRUCT_DECL/STRUCT_INIT/FIELD_ACCESS 3 种新节点
- parser: struct 声明 + .field 访问 + Name{field:val} 初始化
- sema: struct 类型符号表,字段类型解析,初始化字段检查
- codegen: LLVMStructType + extractvalue/insertvalue 字段操作
- 新增集成测试: 12_struct.l, 13_struct_nested.l
- 基于 Codex 分析报告 P0 #4
所有 P0 功能已全部完成。
20 lines
310 B
Plaintext
20 lines
310 B
Plaintext
struct Point {
|
|
x: i64,
|
|
y: i64,
|
|
}
|
|
|
|
struct Rect {
|
|
top_left: Point,
|
|
bot_right: Point,
|
|
}
|
|
|
|
fn main() -> i64 {
|
|
let r: Rect = Rect {
|
|
top_left: Point { x: 0, y: 10 },
|
|
bot_right: Point { x: 5, y: 0 },
|
|
};
|
|
print_i64(r.top_left.x);
|
|
print_i64(r.bot_right.y);
|
|
return 0;
|
|
}
|