#include "h.h" #include #include static int const lp = '(', rp = ')'; static env dw; // the values put here by main are unused! env * gw(int z){return &dw;} void crsh(char* d, cp e){printf("%s: compiler bug at %d!", d, e-code); exit(0);} void epr(cp x, int cd){ uchar op = *x; if(op < 253) {if(op>cd) crsh("bad sym\n", x); printf(" %c ", cd-op+'a');} else if(op == 254) {cp argE = 3+x+*(us *)(x+1); // Locate expr for argument. putchar(lp); epr(x+3, cd); // function to apply epr(argE, cd); // argument to apply it to putchar(rp);} else if(op == 255) { putchar(lp); putchar(0xce); putchar(0xbb); printf("(%c)", cd-op+'a'); epr(x+1, cd+1); putchar(rp);} else {nis y = 0; ++x; do y = y<<7 | (*x & 0x7f); while(*(x++) < 0x80); {void pc(nis x){if(x>10) pc(x/10); putchar('0'+x%10);} pc(y);}}} val eval(cp x, env * e){epr(x, 0); printf("\n"); return (val){0, { .i = 0}};}