Ricochet: The Stack is Back

A pure-postfix, stack-based programming language with dynamic class-based OOP, source-mapped bytecode metadata, and capability-first side effects. Built for the modern stack.

100%
Postfix — No Infix Parser
2
VM Stacks — Compile & Runtime
Rust
Bytecode VM
v1
Web MVC Built-in

Run Snippets Live

Write postfix Ricochet code in your browser. Watch the data stack shift, push, and pop in real-time as your code compiles and executes.

main.rco
Load Template:
Instruction Trace (IP)
Code trace will appear here
VM Status: Ready

Why Ricochet?

Preserving postfix stack thinking while building modern, PostgreSQL-backed MVC web apps and robust CLI tooling.

Pure Postfix Execution

No infix parser. No operator precedence. Every operator is a word, every word is a stack operation. Data flows left to right, always.

🏗️

Class-Based OOP

Open classes, dynamic creation, and runtime metaprogramming — without turning the language into Java with Forth punctuation. Postfix declarations: name first, keyword second.

🔍

Stack-Aware Debugger

Breakpoints, break-on-fault, task inspection, and full stack traces with source maps. Debug running requests, spawned tasks, and async work from the terminal.

🛡️

Capability-Oriented

No magical global IO. Apps, tests, plugins, and hosted scripts receive explicit powers through context injection. Request, db, logger, view — all capability objects.

🌐

Web MVC Built In

Routes, controllers, PostgreSQL Active Record, and HTML templates with full Ricochet interpolation. rco serve --watch with hot reload and stable request snapshots.

📦

Batteries Included

Single CLI for everything you need. Project scaffolding, dependency management via ricochet.toml, test suites, and compile-time documentation generation.

Write Postfix OOP Code

Object-oriented programming in postfix is clean and readable. Let's see the structure.

Subclassing & Variable Access

In Ricochet, class declarations use the postfix structure Name Parent subclass. We end definitions and blocks using the universal word end.

Comments are enclosed in double parentheses (( ... )). Comments immediately preceding declarations compile as their docstring documentation.

Variables are declared with postfix var (e.g., amount var), written with set, and read with get. Field mutation uses dot keywords: $user .email retrieves the field, and "a@example.com" $user .$email set sets it.

Method calls use the explicit dot form $object .methodName. In methods, the receiver is bound to $self.

user.rco
(( Represents a user account ))
User Model subclass
  users table
  id field
  email field
  name field

  displayName method
    $$self .name empty? if
      $$self .email
    else
      $$self .name
    end
  end
end

user var
User new $user set
"Alice" $user .$name set
$user .displayName println

(( Output terminal: Alice ))

Install Tooling

Get the Ricochet CLI compiler and package manager up and running instantly.

$ curl -fsSL https://ricochet-lang.org/install.sh | sh
> Installing ricochet (rco) v1.0.0-draft...
$ rco new web blog
> Created blog project: ricochet.toml, config/routes.rco
$ rco run app.rco

Built-in Tooling

The ricochet CLI (short alias rco) includes everything you need:

  • rco new: Creates a minimal web/cli project scaffolding
  • rco serve --watch: Live HTTP server with snapshot hot-reloading
  • rco repl: Ephemeral live metaprogramming workspace
  • rco test --debug: Runs test classes under VM debugger