The RVM — documentation


The RVM — documentation

The RVM is an ooRexx-compatible Rexx Virtual Machine. A compiler written in ooRexx turns the Rexx Parser's abstract syntax tree into R-code, a text program format; a machine runs R-code with a runtime that implements the rest of ooRexx 5 (decimal arithmetic, the object model, the built-in functions, the class library, streams, commands, queues, the common native libraries). The machine has two hosts that run the same R-code: one written in ooRexx (../RVM.*.cls, run by native ooRexx 5) and one in JavaScript (../js/, run by Node.js or in a web browser). Native ooRexx 5 is the oracle: a program must behave on the RVM exactly as it does on rexx. These chapters describe baseline version 0.1, for both hosts, in enough detail for an engineer or an agent to take over the project.

At a glance

Version 0.1: R-code format 1 (RVM.RCode~VERSION, JS RCODE_VERSION), instruction set 1 (RVM.ISA~VERSION, JS ISA_VERSION), compiler 0.2 (RVM.Compiler~VERSION). The first two are ::Constant VERSION of their classes in ../RVM.Machine.cls and constants in ../js/rcode.mjs; the third is ::Constant VERSION in ../RVM.Compiler.cls. The other chapters name them only by constant (04).
To run ooRexx 5 (rexx) for the ooRexx host and for compiling; Node.js 22 or later (node) for the JS host, which calls rexx to compile. The RVM sits in bin/modules/rvm/ of the Rexx Parser.
To test also Python 3, bc, timeout; Subversion (svn) and network access to export ooTest for the census (16). Rebuilding the prelude from scratch needs ooRexx's CoreClasses.orx and StreamClasses.orx (10).
Checks (two cores) smoke test: a few minutes; tests/check.sh quick: about 7–10 minutes; the whole OO end-to-end suite: about 25 minutes; tests/check.sh full: at least that (16).

Chapters

File Content
01-overview.md What the RVM is and is not, principles, architecture, the two hosts, how to run it, environment variables, glossary
02-values-and-arithmetic.md The value model, byte strings, the Number object, decimal arithmetic, NUMERIC, whole numbers, comparisons
03-compiler.md From AST to R-code: structure, name resolution, directives and packages, ::REQUIRES, INTERPRET, the .rcode cache
04-rcode.md The R-code file format, the execution model, the instruction table and verifier, every instruction
05-machine.md The dispatch loop, activations, variables and stems, CALL/SIGNAL/RETURN/PROCEDURE/EXPOSE, PARSE, NUMERIC, TRACE, runSync
06-conditions-and-errors.md Traps, CALL ON and SIGNAL ON, RAISE, the condition object, the error report and traceback, error texts
07-concurrency.md Activities and the scheduler, GUARD, REPLY, START, Message, semaphores, the clock, Alarm/Ticker, HALT, UNINIT
08-objects.md The object core: sends, scopes, MRO, classes, metaclasses, mixins, ABSTRACT, annotations, the security manager, NOSTRING
09-reflection.md Method, Routine, Package, .context, StackFrame, VariableReference, .local/.environment, NAMESPACE, .RexxInfo
10-prelude-and-classes.md The prelude and how it is generated; the class library: collections, Stem, String, MutableBuffer, hash order
11-builtins.md The built-in functions: dispatch, argument checking, errors, DATE/TIME, RANDOM, VALUE
12-libraries.md The library registry, EXTERNAL, RXFUNCADD, REXXUTIL, rxmath, rxregexp, rxsock, hostemu, the macrospace
13-io-and-commands.md Streams and .File, ADDRESS and WITH, commands, queues and RXQUEUE, the host interface
14-javascript.md The JS host: module map, Node.js and the browser, generated modules, how it replaces what ooRexx provides
15-source-map.md Every file of both hosts, with its role, licence and chapter; the ooRexx ↔︎ JS correspondence
16-testing.md Test suites, oracles, the smoke test, the ooTest census
17-divergences.md Every known difference from native ooRexx, with its reason and status
18-known-gaps.md What is missing or wrong: the work list
19-licensing.md Apache 2.0 and CPL 1.0 files, why, and the rule for new files
20-maintaining.md Principles, conventions, the change workflow, what to run when you touch what
21-recipes.md Step by step: adding a built-in function, a native method, a prelude method, an R-code instruction, a library routine

The notes in ../smoke/README.md, ../tests/README.md and ../js/README.md sit next to the code; where they and these chapters differ, the chapters are the description of the baseline.

Reading orders

Newcomer (to understand the whole): 01 → 02 → 04 (the execution model and a skim of the instructions) → 03 → 05 → 08 → 06 → 07 → 10 → 14 → 20. The remaining chapters are references, to be read when their subject comes up. Run rvm -l on a small program while reading 04 and 05.

Fixing a bug (a program behaves differently from native): 1. Check 17-divergences.md and 18-known-gaps.md: it may be accepted, pending a decision, or known. 2. Reproduce it on native and on both hosts (01); if only one host fails, the hosts have drifted apart (15 finds the matching code). 3. Locate the layer: compile-time errors and wrong R-code in 03/04 (rvm -l shows the code); control flow, variables and trace in 05; conditions and reports in 06; then the chapter of the feature (objects, BIFs, streams...). 4. Fix both hosts, add a test, run the checks of 20 and the suites of 16; update the chapter that describes the behaviour.

Adding a feature (a built-in function, a method, an instruction, a library routine): 21, then 20.

Porting to a new host (another language or runtime): 01 → 04 (the contract: format, verifier, every instruction) → 02 (what a value and a number must be) → 05 → 06 → 07 → 08 → 14 (how one port was done: the host interface, generated tables, the mapping of what ooRexx provides) → 15 (the file-by-file plan) → 14 and 13 (the host interface: JS members, ooRexx classes) → 16 (checking the port on the same R-code against an existing host). The compiler does not need porting: run it on native ooRexx, or on the new machine itself as the browser does.

Conventions used in these documents

  • Both hosts. Every mechanism is described once, for both hosts. Code names are given as RVM.Name (ooRexx host) / Name (JS host), or as Method / method when the JS name is camel-cased. Each chapter has a "Host differences" section where they differ.
  • Native means native ooRexx 5, the rexx interpreter. Facts about it cite the ooRexx source file (RexxActivation.cpp, CoreClasses.orx...) when known.
  • Links to code are relative to this directory (../RVM.Machine.cls, ../js/machine.mjs) and name the method or routine, never a line number: search for the name.
  • Versions are named by their constants (RVM.Compiler~VERSION, RVM.ISA~VERSION, RVM.RCode~VERSION), not by value; their values are given only in At a glance.
  • Error numbers are written major.minor as ooRexx reports them (40.11, 93.900); "SYNTAX 98.903" is the condition with that code.
  • Design notes at the end of a chapter give the decisions and their reasons; Known gaps list what is not implemented or is wrong, collected in 18; divergences are cross-referenced to 17.
  • Examples are short and checked against both hosts and native unless the text says otherwise. Shell examples assume the current directory is bin/modules/rvm/.
  • The code is the truth: when a chapter and the code disagree, the code wins and the chapter is to be fixed (20).

Copyright (c) 2026 Josep Maria Blasco. Part of the RVM, the Rexx Virtual Machine (https://rexx.epbcn.com/rexx-parser/). This documentation (every file of doc/) is licensed under the Apache License 2.0 (https://www.apache.org/licenses/LICENSE-2.0); see ../NOTICE.