How jashhh0908/bytevm works
byteVM is a C11 implementation of a small programming language. A script is read by the command-line entry point, tokenized, parsed into an AST, compiled to bytecode, then executed by a stack VM. The compiler also tracks lexical scopes and variable slots; the VM uses call frames for functions and recursion. The README documents variables, control flow, functions, and primitive data types. Relationships for the main pipeline are shown in source or documented; unsampled subsystems are not expanded.
Main entry points: vm.c Virtual Machine · main.c Program Entry · codegen.c Bytecode Compiler · parser.c Parser
Components 13
Compilation
- Bytecode Compiler
src/compiler/codegen.c - Scope Symbols
src/compiler/symbol_table.c
Runtime
- Instruction Chunk
src/runtime/chunk.c - Bytecode Opcodes
src/runtime/bytecode.h - Runtime Values
src/runtime/value.c - Virtual Machine
src/runtime/vm.c - Call Frames
src/runtime/vm.h
Other components
- Source Script
- Program Entry
src/main.c - Program Output
Connections 14
- Source Script → Program Entry: provides file
src/main.c - Program Entry → Lexer: initializes
src/main.c - Lexer → Parser: supplies tokens
README.md - Program Entry → Parser: parses program
src/main.c - Parser → AST Model: constructs nodes
src/syntax/parser.c - Program Entry → Bytecode Compiler: compiles AST
src/main.c - Bytecode Compiler → Scope Symbols: tracks scopes
src/compiler/codegen.c - Bytecode Compiler → Instruction Chunk: emits instructions
src/compiler/codegen.c - Instruction Chunk → Bytecode Opcodes: stores instructions
- Program Entry → Virtual Machine: initializes and runs
src/main.c - Virtual Machine → Instruction Chunk: executes bytecode
- Virtual Machine → Runtime Values: operates on values
src/runtime/vm.c - Virtual Machine → Call Frames: manages calls
src/runtime/vm.c - Virtual Machine → Program Output: prints results
README.md