This commit is contained in:
Lobo 2026-02-09 10:42:23 -03:00
parent 1746d12266
commit d279bf1d31
17 changed files with 407 additions and 137 deletions

View file

@ -1,23 +1,25 @@
#include "core/opcodes.h"
#include <growl.h>
#include <math.h>
int main(void) {
GrowlVM *vm = growl_vm_init();
growl_register_file_library(vm);
GrowlLexer lexer = {0};
lexer.file = stdin;
Growl obj = growl_compile(vm, &lexer);
if (obj != GROWL_NIL) {
GrowlQuotation *quot = growl_unwrap_quotation(obj);
growl_disassemble(vm, quot);
growl_vm_execute(vm, quot);
printf("Stack:");
for (Growl *p = vm->wst; p < vm->sp; p++) {
putchar(' ');
growl_print(*p);
if (!growl_vm_execute(vm, quot)) {
if (vm->sp != vm->wst) {
fprintf(stderr, "Stack:");
for (Growl *p = vm->wst; p < vm->sp; p++) {
putc(' ', stderr);
growl_print_to(stderr, *p);
}
putchar('\n');
}
}
putchar('\n');
}
growl_gc_collect(vm);