jsvm
wipA bytecode compiler and stack VM for a subset of JavaScript.
A compiler pipeline that takes a JavaScript-like language and produces bytecode for a custom stack-based virtual machine. Covers lexing, recursive descent parsing, an AST, a bytecode emitter with backpatching for control flow, and a VM interpreter. The natural follow-up to writing a compiler in C — this time targeting a higher-level runtime.
stack
CTypeScript
highlights
- Full pipeline: source → tokens → AST → bytecode → VM execution
- Supports variables, arithmetic, conditionals, while loops, and functions
- Backpatching-based jump resolution for control flow
- Arena allocator for AST nodes — single free at end of compilation