EVE Virtual Machine
Running a script
The machine is one program, eve. The official implementation is written in Zig, in the folder evevm/ of the repository, and built to bin/eve.exe. Eve 0.1 does one thing: it runs a script.
eve script.eve ** run an aspect: it is the driver of the run
eve script.eve 5 -p x 10 ** values for the parameters of main
eve script.eve -h ** help, made from the ** @param comments above main
- A short parameter name is written
-p value, a long one--param value. A value is any Eve literal: it is parsed and converted to data; - The comments above
mainof the form** @param x: "description"are the help text. Without them,-hlists the parameters; - The machine returns the exit code of the process to the operating system: 0 for
returnandover, 1 forpanic, 2 for a failedexpect, 4 forraiseor a run-time error, 5 for an unexpected stop (see Processing).
What happens when a script runs
- Load: the machine reads the script and the modules it imports, searching them in
$EVE_LIBand the folders of the project; - Compile: the scripts are compiled in memory, to a tree in version 0.1. The compiler stops with an error before anything runs when it finds a mistake, for example a
concurrent aspectthat calls a function that is not thread safe; - Initialize: every imported module is initialized once (
initialize); - Run: the process
mainof the driver runs, and applies or starts aspects; - Finish: the modules are finalized in reverse order, the memory is released and the machine returns the exit code.
How the machine manages memory
A program never frees memory itself: EVE does it while the program runs. Every value that needs memory (a string, a list, a map, an object, a function) counts the places that hold it: variables, elements of collections, attributes, closures. This is reference counting. When the count of a value falls to zero, nobody can use it any more and its memory is given back.
The memory is given back at a safe point: at the end of a statement, at the end of each pass of a loop, and at done. A loop that makes a string and a list at each pass keeps only the last ones; a million passes need the memory of one.
for i in (1..1000000) do
new line := "item {i}"; ** the previous line is freed at the end of the pass
new parts := (i, i + 1, i + 2);
let total += parts.length();
done;
Reference counting cannot free a cycle: a function that closes over the scope that holds it counts that scope, and the scope counts the function. A tracing collector is the backup: it finds what the program can still reach and frees the rest. It runs at the done of a job, of a parallel group and of a process, and when the program has made many values since its last run. While the aspects of a parallel group run, nothing is freed; the memory they left is given back at done.
EVE_MEMSTATS=1 eve script.eveprints, at the end, how many values were made, how many were freed by counting and by tracing, and how many are left;- The tests of the machine run with
EVE_GC_VERIFY=1, which checks every free against a trace.
Configuration
EVE virtual machine can load system environment variables from a configuration file. These are stored as "$key = value" pairs, where the value is a valid Eve literal. Some system constants can be derived from environment variables using the smart concatenation operator "/".
A configuration file have extension .cfg. One application can run with different configuration file. Application documentation must contain description of all variables required by the application.
A good practice is to provide a configuration template . The template file may contain # comments and $key = value pairs. Values can be numeric, string, symbol, date, time or data literals: [],(),{}. Eve application will automatically parse configuration file to read values for the system variables.
System variables of the machine
The machine provides the system variables, which start with $. The folders below say where it looks for things; the full register, with types and status, is in spec/semantics/variables.md.
| Variable | Meaning | Default |
|---|---|---|
$EVE_LIB | folder of the installed libraries, searched by from … use | $EVE_DIR/lib |
$EVE_ASP | folder of the aspects of a driver | asp, then the project root, then lib |
$EVE_OUT | output folder of the log files | out |
$EVE_CORE_DB | the core database of the project (SQLite): logs of the ETL runs, checkpoints, metadata, data of the Eve UX; set by core_db in eve.cfg | db/eve.db |
$cores | the hardware cores of the machine, read only | number of cores, at most 16 |
$max_parallel | tasks of one parallel group that run at a time; a start beyond it waits; a program may change it | 8 |
$timeout | seconds a task waits on a channel | 60 |
Modes of the machine
eve script.eve.Eve scripts are executed using a virtual machine. You can start the virtual machine as a service or as console application. In console you can run only one driver script at a time. In service mode you can run multiple drivers in parallel. Each driver is independent, it has its own scope (memory location) and can't communicate with other drivers executed by EVE in the same time.
Configuration: Eve services using a general configuration file: eve.cfg. This file contains default settings for EVE machine. System variables are shared. A copy of EVE system variables is send to every new driver instance.
Configuration settings are loaded over the default values and have priority. In a process, you can temporary change the settings with an assignment. These changes do not propagate back into the configuration file.
Memory allocation: EVE service is in charge of allocating memory for each process. There is no shared memory between processes. When a process is terminated the memory is cleaned up of garbage and the machine continue to run until all processes are finished.
To execute a driver there are these ways:
- Using the "eve" system command:
eve script.eve, - Planned: using console REPL commands: parse, debug and execute (see
manual/usage.md), - Planned: EVE virtual machine can be run as a daemon,
- Planned: you can control EVE virtual machine using command: eve with parameters
Exclusive Mode
Planned, not in 0.1. When eve is executed, it can be started with parameter: -x or --exclusive. This is a signal that only one session can run at a time. In this mode a second driver is refused while any other driver is active. Asynchronous methods called inside a driver are not affected. You can use this more especially for debugging or tuning purpose.
Inside eve: modules and parts
The virtual machine began as one Zig program. It is being split into modules, each with one job, while it stays one program with one version, eve (decided on 2026-10-12, D-163):
| Module | Job | Part of eve |
|---|---|---|
evecm | what every module shares: values and memory, codecs (Decimal, time, Unicode, CSV, JSON), the configuration, JSON-RPC and the sockets | none: the base of all |
evecp | the compiler: reads, checks and links the source; later writes bytecode | eve cp |
evevm | the runtime: runs scripts, the prompt, the machine and its IPC door | eve vm (the default) |
evedb | the databases: SQLite inside, DuckDB loaded when needed, stored procedures and SQL functions in Eve | eve db |
evewp | the web part: the web door, the portal, AI agents | eve ux |
The first word after eve chooses the part, and without such a word eve works as before: eve script.eve runs a script. The modules depend on each other in one direction only, toward evecm, and the build refuses any other link, so each part can grow without tangling with the others. The Eve standard library, written in Eve, sits next to them in lib/.
The split comes in two steps. In version 0.0.5 the source is divided and the four words appear; in version 0.0.6 a machine that stays active runs its parts side by side in one process (The serving machine), and the compiler learns to write bytecode, which the runtime can load instead of the source.
Tools around the machine
eve --docmakes the documentation of a library from its**comments and signatures;- The test runner
script/runtest.pyruns the conformance tests on any implementation (see Compiler); - The machine can also run remotely and serve requests: see Server.
Read next: Shell Commands