stage1 实现部分ast2ir内容并重构stage0 引入并重构ir2vm 构建系统修改部分

This commit is contained in:
zzy committed 2026-08-28 13:01:19 +08:00
1 parent 3d57260f3f
commit 34df303b56
17 files changed
+636 -1800

No files matched your search

+9
View File
@@ -29,6 +29,7 @@ typedef struct {
int debug;
int debug_cli;
int trace;
int disasm;
const char *entry;
const char *path; /* file.sir */
const char **args; /* spl 程序参数(file.sir 之后) */
@@ -39,6 +40,7 @@ static void usage(void) {
fprintf(stderr, "Usage: spl_cli [options] <file.sir> [args...]\n"
" -d, --debug stack-canary checks\n"
" -g, --debug-cli interactive debugger (REPL)\n"
" --disasm disasm dump sir\n"
" --entry <name> entry function (default: main)\n"
" --trace print every instruction\n"
" -h, --help show help\n");
@@ -63,6 +65,8 @@ static int parse_args(int argc, const char **argv, cli_opts_t *o) {
o->debug_cli = 1;
} else if (strcmp(a, "--trace") == 0) {
o->trace = 1;
} else if (strcmp(a, "--disasm") == 0) {
o->disasm = 1;
} else if (strcmp(a, "--entry") == 0) {
if (i + 1 >= argc) {
fprintf(stderr, "spl_cli: --entry needs a name\n");
@@ -624,6 +628,11 @@ int main(int argc, const char **argv) {
fprintf(stderr, "spl_cli: cannot load '%s'\n", o.path);
return 1;
}
if (o.disasm) {
spl_prog_dump(&prog);
return 0;
}
spl_syscall_register(&prog);
spl_vm_t vm;