Exemplo n.º 1
0
static void bf_run(const char* program) {
    bf_state_t state;
    uchar tape[TAPE_SIZE];
    bfprogram bfp;
    state.tape = tape;
    state.get_ch = get_ch;
    state.put_ch = put_ch;
    bfp = bf_compile(program);
    bfp(&state);
}
Exemplo n.º 2
0
int main(int argc, char const *argv[]) {
    jit_context_t cx = jit_context_create();

    char *data = calloc(50000, sizeof(char));
    jit_ptr arg1;
    void *args[1];

    FILE *fp = fopen(argv[1], "rb");
    jit_function_t function = bf_compile(cx, fp);
    fclose(fp);
    jit_context_build_end(cx);
    arg1 = data;
    args[0] = &arg1;
    jit_function_apply(function, args, NULL);
    jit_context_destroy(cx);
    return 0;
}