1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #include <stdio.h>
- #include <stdlib.h>
- #include <assert.h>
- #include <string.h>
- #include <errno.h>
- #include "sans.h"
- #include "symboltable.h"
- #include "stack.h"
- #include "garbagecollector.h"
- #include "runtime.h"
- sdata sans_glo[2];
- sdata ret_reg;
- sdata env_reg;
- int main(void) {
- sdata n;
- u label = 6;
- while (1) {
- switch (label) {
-
- case 0:
- ret_reg = (sdata){.tag = tsymb, .data.value = intern("hello-world")};
- env_reg = stack_pop();
- n = stack_pop();
- assert(n.tag == tlabl);
- label = n.data.value;
- break;
-
- case 3:
- ret_reg = builtin_print(TODO);
- env_reg = stack_pop();
- n = stack_pop();
- assert(n.tag == tlabl);
- label = n.data.value;
- break;
-
- case 6:
- stack_push((sdata){.tag = tlabl, .data.ivalue = 10});
- stack_push(env_reg);
- label = 0;
- break;
-
- case 10:
- sans_glo[0] = ret_reg;
- stack_push((sdata){.tag = tlabl, .data.ivalue = 15});
- stack_push(env_reg);
- label = 3;
- break;
-
- case 15:
- sans_glo[1] = ret_reg;
- exit(0);
- }
- }
- }
|