The .kry -> Kir parser is now a shared library (cmd/kir/kir_parse.c + kir_parse.h) exposing kir_parse_file(path, root) -> KirProgram*. Both k2c (the C backend) and k2b (the krb backend) can link it to share one frontend. k2ir/main.c is now a thin wrapper: parse + KirProgramDump to a .kir file. The output path uses the module's source_path to preserve directory structure. k2ir_test passes; make test green. The k2c backend (Stage 2) can now link kir_parse.c to get Kir input.
15 lines
416 B
C
15 lines
416 B
C
#ifndef KRYON_KIR_PARSE_H
|
|
#define KRYON_KIR_PARSE_H
|
|
|
|
#include "kir.h"
|
|
|
|
/*
|
|
* Parse a .kry source file into a KirProgram. Returns a heap-allocated
|
|
* program (caller frees with KirProgramFree), or NULL on fatal error.
|
|
* This is the shared Kir frontend used by k2ir (dump), k2c (C backend),
|
|
* and k2b (krb backend).
|
|
*/
|
|
KirProgram *kir_parse_file(const char *path, const char *root);
|
|
|
|
#endif /* KRYON_KIR_PARSE_H */
|