ooh okay diva
This commit is contained in:
parent
90175b7e26
commit
58ba150c93
17 changed files with 1122 additions and 94 deletions
24
next/main.c
24
next/main.c
|
|
@ -1,18 +1,26 @@
|
|||
#include "core/opcodes.h"
|
||||
#include <growl.h>
|
||||
|
||||
static uint8_t code[] = {
|
||||
GOP_PUSH_NIL,
|
||||
GOP_RETURN,
|
||||
};
|
||||
|
||||
int main(void) {
|
||||
GrowlVM *vm = growl_vm_init();
|
||||
GrowlLexer lexer = {0};
|
||||
lexer.file = stdin;
|
||||
|
||||
Growl quot_obj = growl_make_quotation(vm, code, sizeof(code), NULL, 0);
|
||||
GrowlQuotation *quot = (GrowlQuotation *)(GROWL_UNBOX(quot_obj) + 1);
|
||||
vm_doquot(vm, quot);
|
||||
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);
|
||||
}
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
growl_gc_collect(vm);
|
||||
growl_vm_free(vm);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue