Skip to content
프로젝트

소개

r3 programing language - ColorForth inspired

프로그래밍 언어 및 런타임

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

r3forth

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.

Technical Overview

  • 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 and Immediate Mode GUI (rimm, multi-backend: SDL2 and OpenGL).
  • Tooling: Integrated editors and a growing collection of games and demos.

Quick Start

You don't need to clone the repository; you can download the latest version here. latest release(.zip)

WINDOWS

Extract and run r3.exe. No installation required.

LINUX Mint / Ubuntu / Debian

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:

./r3lin

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

NixOs

Use the fhs.nix from distro

nix-shell fhs.nix
./r3lin

macOS

r3 requires SDL2 libraries, which can be easily installed using Homebrew.

  1. Install dependencies:
brew install sdl2 sdl2_ttf sdl2_image sdl2_mixer

2a. Run the precompiled binary:

./r3mac

or

2b. Build and Run: If you want to build the VM from source:

# Clone the VM core
git clone https://github.com/phreda4/r3evm
cd r3evm && make
# Move the binary back to the main folder
mv r3mac ../ && cd ..
./r3mac

(Note: On newer versions of macOS, you may need to allow the binary to run via System Settings > Privacy & Security if macOS blocks it as an unidentified developer app on first launch.)


Workflow: How to use r3

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.

3. First program

Red box in the corner program

^r3/lib/sdl2gfx.r3

:main
	0 cls
	$ff0000 color
	10 10 100 100 frect
	sdlredraw
	sdlkey
	>esc< =? ( exit )
	drop ;
	
:
	"red box in the corner" 800 600 SDLinit
	'main SDLShow
	SDLquit 
	;

4. Folder Structure

  • 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++

Showcase & Demos

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

Games in itch.io


More documentation

In the /doc folder.


Youtube Channel

관련 프로젝트 살펴보기

불러오는 중…