How phreda4/r3evm works
r3 is a Forth-family concatenative language VM. Its principal workflow is to load a source program, tokenize and compile it into dwordcode, then interpret that code. The README specifically documents automatic constant folding, short-word inlining, tail calls, and hidden optimized tokens, as well as dynamic-library calls for OS access. The sampled C++ source supports the compile/run and syscall boundaries; other library and tool directories are shown as capabilities, without asserting unsampled call wiring.
Main entry points: r3.cpp VM interpreter · main.r3 R3 program
Components 15
Compile pipeline
- Source compiler
r3.cpp - Tokenizer
r3.cpp - Token optimizer
r3.cpp - Dwordcode
r3.cpp
VM runtime
- VM interpreter
r3.cpp - Data and return stacks
r3.cpp - Dynamic calls
r3.cpp
Language ecosystem
- R3 system modules
r3/system - IDE and tools
r3/d4 - Language libraries
r3/lib - Utilities
r3/util - Terminal examples
r3/term
Other components
- Program author
- R3 program
main.r3 - Host OS libraries
Connections 10
- Program author → R3 program: writes
- R3 program → Source compiler: loads source
- Source compiler → Tokenizer: tokenizes
- Tokenizer → Token optimizer: optimizes tokens
- Token optimizer → Dwordcode: emits code
- Source compiler → VM interpreter: starts execution
- Dwordcode → VM interpreter: executes
- VM interpreter → Data and return stacks: uses
- VM interpreter → Dynamic calls: dispatches calls
- Dynamic calls → Host OS libraries: loads and calls