next: *
This commit is contained in:
parent
1746d12266
commit
d279bf1d31
17 changed files with 407 additions and 137 deletions
20
next/main.c
20
next/main.c
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue