Add astgen scaffolding with ZIR data structures and first passing test
Introduce zir.h/zir.c with ZIR instruction types (269 tags, 56 extended opcodes, 8-byte Data union) ported from lib/std/zig/Zir.zig, and astgen.h/astgen.c implementing the empty-container fast path that produces correct ZIR for empty source files. The test infrastructure in astgen_test.zig compares C astGen() output field-by-field against Zig's std.zig.AstGen.generate() using tag-based dispatch, avoiding raw byte comparison since Zig's Data union has no guaranteed in-memory layout. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,8 @@ const headers = &[_][]const u8{
|
||||
"common.h",
|
||||
"ast.h",
|
||||
"parser.h",
|
||||
"zir.h",
|
||||
"astgen.h",
|
||||
};
|
||||
|
||||
const c_lib_files = &[_][]const u8{
|
||||
@@ -12,6 +14,8 @@ const c_lib_files = &[_][]const u8{
|
||||
"ast.c",
|
||||
"zig0.c",
|
||||
"parser.c",
|
||||
"zir.c",
|
||||
"astgen.c",
|
||||
};
|
||||
|
||||
const all_c_files = c_lib_files ++ &[_][]const u8{"main.c"};
|
||||
|
||||
Reference in New Issue
Block a user