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>
12 lines
220 B
C
12 lines
220 B
C
// astgen.h — AST to ZIR conversion, ported from lib/std/zig/AstGen.zig.
|
|
#ifndef _ZIG0_ASTGEN_H__
|
|
#define _ZIG0_ASTGEN_H__
|
|
|
|
#include "ast.h"
|
|
#include "zir.h"
|
|
|
|
// Convert AST to ZIR.
|
|
Zir astGen(const Ast* ast);
|
|
|
|
#endif
|