1
0
Fork 0
forked from fun/fun
fun/src/fun.c

31 lines
654 B
C
Raw Normal View History

2025-09-13 05:09:20 +02:00
#include "bytecode.h"
#include "value.h"
#include "vm.h"
#include "parser.h"
2025-09-13 05:09:20 +02:00
#include <stdio.h>
int main(int argc, char **argv) {
2025-09-13 05:09:20 +02:00
VM vm;
vm_init(&vm);
// If a script path is provided, parse and run it
if (argc > 1) {
const char *path = argv[1];
Bytecode *bc = parse_file_to_bytecode(path);
if (!bc) {
fprintf(stderr, "Failed to compile script: %s\n", path);
return 1;
}
vm_run(&vm, bc);
2025-09-13 05:09:20 +02:00
// Print captured output for user scripts
vm_print_output(&vm);
vm_clear_output(&vm);
2025-09-13 05:09:20 +02:00
bytecode_free(bc);
return 0;
}
2025-09-13 05:09:20 +02:00
return 0;
}