O Language

Execution paths and compatibility

How the interpreter, bytecode VM and experimental ELF compiler differ.

O Language pagesAdvanced topics
On this page

O Language has three execution paths in the runtime source. They share some parser and object code, but their compiler coverage is different.

Path CLI entry What it does
Interpreter olang FILE.ola, olang run FILE.ola, REPL and olang exec Parses source and evaluates its AST. This is the broadest implementation path.
Bytecode VM olang compile -f FILE.ola Compiles to bytecode in memory and runs it in the VM. In this CLI path it does not write a bytecode file.
ELF output olang compile -f FILE.ola -o PROGRAM Calls the experimental ELF backend and writes a Linux x86-64 executable. Unsupported AST nodes fail compilation.

Interpreter

The REPL and source-file runner call the evaluator. The parser recognizes more forms than either compiler path, including file loading, processes, sockets and runtime-specific forms. A form being accepted by the parser still does not guarantee that every operation is complete or portable.

Bytecode compiler and VM

The bytecode compiler has explicit cases for integer, boolean and string values, arrays, hashes, indexing, functions, calls, conditionals and loop forms. The current compiler does not provide a general case for every interpreter AST node; float literals and several system-specific forms are examples that require checking against the compiler source.

The evaluator and bytecode compiler also keep separate built-in registries. Before moving a program from the interpreter to the VM, compare the functions used with evaluator/builtins.go and compiler/builtins.go at the source revision being deployed.

ELF backend

The ELF compiler currently handles a smaller set of AST node types: programs, expression statements, integer/string/boolean literals, infix expressions, identifiers, declarations, calls and arrays. It is not a general compiler for the full language. It has no target architecture option and generates x86-64 Linux code.

Build targets are a separate question

The runtime’s Go build-all target lists Linux amd64/arm64, macOS amd64/arm64 and Windows amd64. That list is distinct from the language’s ELF backend. The OnixOS package recipe currently declares the olang package for x86_64.

For exact command selection, see the CLI reference. For syntax supported by the interpreter, see the syntax guide.