stage1 重构语义分析 ast2ir ir部分
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "spl_ast.h"
|
||||
// #include "spl_ast2ir.h"
|
||||
#include "spl_ast2ir.h"
|
||||
// #include "spl_ir2vm.h"
|
||||
#include "spl_lexer.h"
|
||||
#include "spl_sema.h"
|
||||
@@ -107,16 +107,25 @@ static int compile_spl(const char *src, const char *fname, const char *outpath,
|
||||
// memory leak
|
||||
return 0;
|
||||
}
|
||||
// spl_ast2ir_t a2ir;
|
||||
// spl_ast2ir_init(&a2ir, &sema);
|
||||
// spl_ast2ir_run(&a2ir);
|
||||
// if (a2ir.err_count) {
|
||||
// printf("ast2ir errors=%d, no output\n", a2ir.err_count);
|
||||
// spl_ast2ir_drop(&a2ir);
|
||||
// spl_sema_drop(&sema);
|
||||
// spl_ast_drop(&ast);
|
||||
// return 1;
|
||||
// }
|
||||
|
||||
spl_ast2ir_t a2ir;
|
||||
spl_ir_builder_t ir_builder;
|
||||
spl_ir_builder_init(&ir_builder);
|
||||
spl_ast2ir_init(&a2ir, &ir_builder, &sema);
|
||||
spl_ast2ir_run(&a2ir);
|
||||
if (a2ir.err_count) {
|
||||
printf("ast2ir errors=%d, no output\n", a2ir.err_count);
|
||||
spl_ast2ir_drop(&a2ir);
|
||||
spl_sema_drop(&sema);
|
||||
spl_ast_drop(&ast);
|
||||
return 1;
|
||||
}
|
||||
if (dump == DUMP_IR) {
|
||||
spl_ir_dump(&ir_builder.ir, &type);
|
||||
// memory leak
|
||||
return 0;
|
||||
}
|
||||
|
||||
// spl_ir2vm_t ir2vm;
|
||||
// spl_ir2vm_init(&ir2vm, &a2ir.ir, &sema.type);
|
||||
// int rc = spl_ir2vm_run(&ir2vm, outpath);
|
||||
|
||||
Reference in New Issue
Block a user