
r3
Minimalist Forth language for games and systems programming
Replaces —

Who it's for
r3 ships with sprite systems, tilemaps, font rendering, and SDL2-based windowing and input handling. The author has published games built in r3 on itch.io, demonstrating that the environment is capable of shipping real, playable games.
If you need a large asset pipeline, visual scene editor, collaboration features, or a mainstream programming language for working with a team, r3 is not the right tool. It is built around deep Forth knowledge and suits one-person or small-team projects.
r3 implements the core Forth philosophy: stack-based evaluation, direct hardware access via dynamic libraries, a self-hosting compiler, and minimal runtime overhead. It is a complete, working example of a concatenative language for programmers who want to understand that paradigm hands-on.
If your goal is production systems software for a team with review requirements, r3's small community and limited documentation make it a poor fit compared to more established concatenative language environments.
r3's design philosophy, toolset (integrated editor, games, demos), and community topics (videogames-programmers, colorforth) align with the demo scene and retro creative coding aesthetic: small binaries, direct graphics access, and tools built from first principles.
If you need compatibility with modern graphics APIs such as Vulkan or Metal, or integration with popular game engines, r3's SDL2-based layer does not cover those targets.
The problem
Most programming environments ship with multi-megabyte runtimes, package managers, and toolchain layers that add complexity without adding capability for simple, direct programs. For developers who want to build games, interactive demos, or creative tools close to the hardware, those layers are friction, not features. Game development environments aimed at hobbyists often bundle proprietary scripting languages tied to a specific platform, making the underlying system opaque and non-portable. The Forth stack-based model takes a different approach: evaluation is direct, the runtime is compact, and the programmer controls exactly what happens at each step. The challenge is that most Forth environments are either too bare-bones for practical game work or tied to specific hardware platforms from past decades. r3forth fills this gap with a Forth-inspired environment that includes practical graphics primitives, game tools, and an integrated editor inside a runtime that fits in ~40KB.
How it works
The r3evm virtual machine is written in C and compiles to approximately 40KB. It starts in milliseconds, runs on Windows and Linux, and requires no installer. The core is portable enough to be recompiled from source when binary compatibility is a concern.
r3 ships with a library layer built on SDL2 that provides sprites, tilemaps, fonts, animations, and stack-based sprite management. SDL2 handles cross-platform windowing, input, and audio; r3's layer on top provides the game-specific primitives needed for 2D game and demo creation.
r3 can load and call procedures from any dynamic library: DLL on Windows, SO on Linux. Any C or system library is accessible directly from r3forth code without writing a separate binding layer in another language.
Running the r3 binary without arguments launches the built-in environment, which includes a code editor, a dictionary browser, and live-coding tools. The internal system scans the /r3 folder on startup to build a menu of available tools and system libraries.
The r3forth compiler is written entirely in r3forth, making the system self-hosting on Windows. This means the language can compile its own runtime, which is the practical benchmark of a sufficiently capable Forth implementation.
Beyond 2D, r3 includes a 3D engine, collision hashing, and a TUI/immediate-mode GUI (immgui). These libraries sit on top of the minimal VM core, making r3 a more capable creative environment than its 40KB footprint suggests.
Features
- Ultra-minimalist VM (~40KB core)
- SDL2 graphics and game library
- Dynamic library interop (.DLL and .SO)
- Integrated editor and IDE environment
- Self-hosting compiler written in r3forth
- 3D engine and immediate-mode GUI
How to install
Installing r3 on Linux requires SDL2 development libraries and building the VM from source.
sudo apt install libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev
git clone https://github.com/phreda4/r3evm
cd r3evm && make
mv r3lin ../ && cd ..
./r3linRecommended for this setup
Strengths
- MIT license with no usage restrictions: r3 is MIT licensed, which means you can use it commercially, fork it, modify it, and ship programs built with it without paying licensing fees or reporting back to the project. The entire source is in the repository.
- Near-zero startup and compile time: The VM starts and compiles scripts in milliseconds. This tight feedback loop is a practical advantage for iterative game development and creative coding, where waiting for compilation interrupts the development flow.
- No toolchain beyond SDL2: On Windows, r3.exe runs directly from a downloaded zip with no installation step required. On Linux, the only external dependency is SDL2, available in all major distribution package managers. No build system, package manager, or additional runtime is needed.
Trade-offs
- Self-hosting compiler is Windows-only: The self-hosting compiler, the r3forth compiler written in r3forth, currently targets Windows only. Linux users can run r3 programs but cannot use the native compiler path to produce standalone executables from r3forth source.
- Forth's stack-based model has a steep learning curve: r3 uses a concatenative, stack-based evaluation model that is unfamiliar to programmers coming from C, Python, or JavaScript. There is no conventional function-call syntax and no named local variables in the usual sense. The mental model is fundamentally different from most mainstream languages, and the learning investment is significant.
- Small community and limited third-party resources: With 217 GitHub stars and 11 forks, r3 is a small project. The ecosystem of tutorials, IDE integrations, and third-party packages is limited to what ships in the repository and the author's YouTube channel and itch.io page. Community debugging support and third-party documentation are minimal.
Tech stack
FAQ
No. The README and build instructions cover Windows and Linux only. macOS is not listed as a supported platform. If macOS support matters, you would need to build the VM from source and resolve any platform-specific dependencies yourself, as no official macOS binary is provided.
MIT. The MIT license allows commercial use, modification, and redistribution without restriction. You can build and sell games made with r3 without owing any licensing fees to the project, and you can fork and modify the source freely.
Pass the filename as a command-line argument: ./r3lin hello.r3 on Linux or r3 hello.r3 on Windows. Running the binary without arguments launches the integrated environment, which loads main.r3 and displays the built-in tool menu.
Yes. r3 can load and call procedures from any dynamic library: DLL files on Windows and SO files on Linux. The README states this explicitly. Any C library, including system graphics, audio, or math libraries, is accessible directly from r3forth code without a separate binding layer.
r3 ships with SDL2 graphics, 2D sprite and tilemap support, a 3D engine, font rendering, and an immediate-mode GUI. The author has published games on itch.io using r3. Primary use cases are 2D games, interactive demos, and creative tools. It is not designed for web, mobile, or server-side software.