GitHub – phreda4/r3: r3 programing language


A Minimalist, Self-Hosted Stack Machine Environment

r3forth is a programming language and environment inspired by ColorForth and the Forth philosophy. It’s designed to be a complete, self-contained system that balances extreme minimalism with practical creative power.

R3 can load and call procedures from any dynamic library (.DLL in windows) or (.SO in linux) the distro use SDL2 library for make games.

  • Ultra-Minimalist VM: A highly portable, lightweight core (~40kb) written in C. It’s designed for simplicity and speed, currently supporting Windows and Linux: r3evm.
  • Zero Bloat Philosophy: No massive standard libraries or complex toolchains. It’s just the core VM, the stack, and your code.
  • High Performance & Native Ambitions: Despite running on a VM, r3 is architected for speed. It features a self-hosted compiler (currently for Windows) written entirely in r3forth, laying the groundwork for future direct-to-metal implementations.
  • Rich Ecosystem: On top of this minimal core, r3 provides a powerful suite of libraries for:
  • Graphics & 2D: Sprites, tilemaps, fonts, animations, and stack-based sprites.
  • Advanced Logic: 3D engine, collision hash, and TUI/Immediate Mode GUI (immgui).
  • Tooling: Integrated editors and a growing collection of games and demos.

r3 requires SDL2 development libraries.

  1. Install dependencies:
sudo apt install libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev

2a. Run the precompiled binary:

Donwload the latest release(.zip)

or

2b. Build and Run:
If you want to build the VM from source (recommended for compatibility):

# Clone the VM core
git clone https://github.com/phreda4/r3evm
cd r3evm && make
# Move the binary back to the main folder
mv r3lin ../ && cd ..
./r3lin
  1. Donwload the latest release(.zip)
  2. Extract and run r3.exe. No installation required.

r3 is flexible. You can use the built-in environment or stay in your favorite terminal/editor.

1. The Integrated Development Environment (IDE)

By default, running the binary without arguments loads the internal system.

  • Execution: Run ./r3lin (Linux) or r3.exe (Windows).
  • Bootstrap: The system automatically loads main.r3. This script acts as the entry point, scanning the /r3 folder to build the internal menu and tools.
  • The Environment: Inside, you have access to the built-in code editor, dictionary browser, and live-coding tools.

2. Standard Text Editor Workflow (CLI)

If you prefer using Emacs, Vim or Notepad++, you can use r3 as a traditional compiler/interpreter.

  • Create your script: Save your code with the .r3 extension (e.g., hello.r3).
  • Run it directly: Pass the filename as an argument:
| linux
./r3lin hello.r3

| windows
r3 hello.r3
  • Development Loop: r3 is designed for instant feedback. The VM starts, compiles, and executes your script in milliseconds.


r3forth1.mp4



r3forth2.mp4


Red box in the corner program

^r3/lib/sdl2gfx.r3

:main
	0 sdlcls
	$ff0000 sdlcolor
	10 10 100 100 sdlfrect
	sdlredraw
	sdlkey
	>esc
  • main.r3: The core startup script.
  • /r3: Contains all the code, the system libraries, the IDE code, and core tools, etc.. all in .r3 code
  • /asm: Compiler folder, not used if you not invoke it.
  • /dll: In WIN you not install anything, the dll is here.
  • /doc: Documentation.
  • /media: graphics, sounds, models, font..etc
  • /mem: use like static memory (for keep info when exit r3)
  • main.xml: syntax coloring for notepad++

r3 is not just a language; it’s a creative suite. Here is what you can find:


develop.mov



games.mov



demo.mov



opengl.mov



In the /doc folder.




Source link

Leave a Reply

Your email address will not be published. Required fields are marked *