Documentation home / Runtime Architecture
greenServeFE Bytecode Virtual Machine
How greenServeFE compiles GSVE source into bytecode and executes it using stack frames, environments, runtime values and native functions.
Execution pipeline
.gsve source → lexer → tokens → parser / AST → compiler → GSCode bytecode → VM → runtime values
Unlike a recursive AST evaluator, greenServeFE compiles parsed programs to a compact instruction stream and executes that stream with an explicit virtual machine.
Code objects and instructions
A GSCode stores instructions, constants, names, child function code objects and parameter metadata. Each instruction records an opcode, integer argument and source line.
typedef struct {
uint8_t op;
int32_t arg;
int line;
} GSInstr;Frames and environments
A VM frame contains the active code object, instruction pointer, operand-stack base and lexical environment. Function environments link to parent environments; closures retain the environment in which they were defined.
Runtime values
The value system represents null, number, boolean, string, array, object, function, native function and iterator. Arrays and objects use reference-counted ownership. clone recursively copies nested array/object data (with a bounded recursion depth) to isolate copies.
Native calls and module loading
Native functions are C function pointers stored as runtime values. Imports use the dynamic loader to find shared objects such as gs_math.so. The VM checks the module initializer symbol and requires it to return an object.
export GREENSERVE_MODULE_PATH=/usr/local/lib/modules greenServeFE program.gsve
Diagnostics and inspection
greenServeFE program.gsveexecutes a program.greenServeFE --dump program.gsvedisassembles bytecode.greenServeFE --trace program.gsvetraces VM execution.greenServeFE --profile program.gsvereports runtime profiling data.greenServeFE --versionprints the executable version.
See bytecode reference, profiler reference and native API reference.
