Loading the code workspace…
Write a compiler that translates simple expressions and statements into your VM's bytecode in C.
Requirements:
Test:
This recursive-descent compiler-to-bytecode pipeline is structurally identical to CPython's compile.c and Lua's lparser.c, both of which parse and emit instructions in a single top-down pass with the same emit-placeholder-then-patch trick for jumps. It's also exactly what Bob Nystrom's Crafting Interpreters walks through for the clox bytecode compiler.
Sample case for Run. Submit grades this sample plus all hidden tests.