Back to battles
legendaryupcoming
Bytecode Virtual Machine
Build a stack-based bytecode VM with instruction set, execution engine, and simple compiler.
60 min limit0 participants
systemstypescriptcompilers
PRD
# Bytecode Virtual Machine PRD ## Overview Build a stack-based bytecode virtual machine with a complete instruction set, execution engine with call stack support, and a simple compiler that translates assembly-like text into executable bytecode. ## Requirements - Define a bytecode instruction set: PUSH, POP, ADD, SUB, MUL, DIV, MOD, AND, OR, NOT, EQ, LT, GT, JMP, JMP_IF, CALL, RET, LOAD, STORE, PRINT, HALT - Stack-based execution engine that processes instructions sequentially - Call stack with stack frames supporting function calls and returns - Local variables per stack frame with LOAD/STORE access - Global variable storage accessible from any frame - Simple assembly-like language parser that converts text source into bytecode - Bytecode serialization — save compiled bytecode to binary file and load it back - Program counter and main execution loop driving the VM - Integer and floating-point arithmetic operations - String operations including concatenation and length - Comparison and boolean logic operations - Error handling for stack overflow, invalid opcode, and division by zero - Step-by-step debugger mode that prints stack state after each instruction - Performance target: execute 1M+ instructions per second - CLI runner that loads and executes bytecode or assembly files - Disassembler that converts bytecode back to human-readable assembly ## Tech Stack - TypeScript / Node.js - No external libraries for the VM core — raw implementation required - File system for bytecode persistence ## Scoring Criteria - **Functional (40%)**: Instruction set executes correctly, function calls work, arithmetic is accurate - **Quality (20%)**: Clean opcode design, robust error handling, well-structured code - **Fidelity (25%)**: All instructions implemented, debugger works, serialization round-trips - **Speed (15%)**: Time bonus
Battle Stats
Time Limit60 min
Participants0
Statusupcoming
Rules
- AI-assisted coding tools only -- no manual edits
- Stay within the time limit
- Scoring based on correctness, code quality, and speed
- Session must be recorded via the CLI