How mrmorningstark/bytecode-interpreter works
This small C++ project runs a built-in bytecode program through a stack-based virtual machine. The entry point assembles instructions, constructs the interpreter, and calls execute(); the interpreter dispatches operations over its stack, call stack, and in-memory address map, then prints results or reports caught errors. The README describes arithmetic, jumps, calls, memory operations, and error handling, all implemented in the execution loop. File loading, an assembler, registers, and JIT compilation are listed only as future improvements. The graph reflects the sampled implementation; several runtime responsibilities share one source file.
Main entry points: main.cpp Program entry · Interpreter.cpp Instruction execution
Components 10
Other components
- User
- Program entry
src/main.cpp - Bytecode program
src/main.cpp - Interpreter
src/Interpreter.cpp - Instruction execution
src/Interpreter.cpp - Operand stack
src/Interpreter.cpp - Call stack
src/Interpreter.cpp - Virtual memory
src/Interpreter.cpp - Standard output
- Standard error
Connections 10
- User → Program entry: runs
src/main.cpp - Program entry → Bytecode program: constructs
src/main.cpp - Program entry → Interpreter: constructs
src/main.cpp - Program entry → Interpreter: calls execute
src/main.cpp - Interpreter → Instruction execution: dispatches
src/Interpreter.cpp - Instruction execution → Operand stack: updates
src/Interpreter.cpp - Instruction execution → Call stack: updates
src/Interpreter.cpp - Instruction execution → Virtual memory: reads/writes
src/Interpreter.cpp - Instruction execution → Standard output: prints
src/Interpreter.cpp - Program entry → Standard error: reports errors
src/main.cpp