A new R implementation

Run real package code in a reentrant Rust interpreter.

miniR is building an embeddable R runtime around real CRAN package behavior, per-interpreter state, native extension loading, and a codebase that stays modular as the language surface grows.

  • The checked-in compatibility corpus is treated as a product requirement, not a vanity benchmark.
  • Interpreter state lives on `Interpreter`, so multiple sessions can coexist in one process.
  • Feature flags keep a path open for embedded and WASM-oriented builds without flattening the full runtime.
first session

A build, a REPL, and ordinary R code without depending on GNU R as the runtime.

$ cargo build --release
$ ./target/release/r
> x <- data.frame(a = 1:3, b = a * 2)
> x
  a b
1 1 2
2 2 4
3 3 6
Parser, evaluator, package runtime, and help system in one binary Feature gates keep parser work light without hiding larger subsystems Native backtraces and package loading are part of the main design, not separate tooling
131 / 260 packages loading in the checked-in CRAN corpus
800+ builtin entry points across core and optional subsystems
Reentrant per-interpreter state instead of process-global mutable runtime state

Why miniR

Why miniR exists

miniR is a new R implementation written in Rust for people who care about runtime design, package behavior, and embeddability.

  • Real package code is the target: the project is measured against a checked-in cran/ corpus, not only parser fixtures or hand-picked examples.
  • The interpreter is explicitly reentrant: mutable runtime state belongs on Interpreter, so multiple sessions can coexist in one process.
  • Architecture matters: parser, evaluator, package loading, native code, graphics, and help are kept as readable subsystems rather than collapsing into one giant runtime blob.

How to use this site

Start with the guide pages if you want the shape of the project:

  • Getting Started covers builds, feature profiles, and how to point miniR at installed R packages.
  • Interpreter Architecture explains where parser, evaluator, values, dispatch, package loading, and graphics live in the codebase.
  • The Interpreter follows evaluation from Session::eval_source() through promise forcing, builtin dispatch, and traceback capture.
  • Parser And Diagnostics explains how pest, AST building, and parse-error rendering fit together.
  • Session API And Embedding explains why Session is the public boundary instead of exposing raw interpreter internals directly.
  • CRAN Corpus Compatibility explains what the headline numbers mean and which missing subsystems still block more packages.
  • Help And Documentation explains how ?topic, package man/ pages, builtin rustdoc, and generated .Rd output share one help pipeline.

Use the manual when you want the reference view:

  • reference pages are generated from the repo docs/ directory
  • pages are ordered intentionally instead of dumped alphabetically
  • the focus is on runtime behavior, divergences, and implementation notes that are useful when working on the interpreter itself

What The Site Covers

Move from orientation pages into subsystem reference without losing the thread.

The guides on the homepage are for understanding the shape of the interpreter. The manual is for longer-form runtime details, intentional divergences, and subsystem reference.

Execution model

Keep interpreter state explicit and local.

miniR is built around per-interpreter state, layered evaluation, and clear ownership of runtime subsystems.

Profiles

Scale the build from minimal to full.

Feature flags keep parser work light while still allowing native loading, graphics, TLS, and heavier runtime pieces in larger builds.

Package runtime

Treat packages as packages, not as loose script files.

Namespace loading, metadata, native code, hooks, and help indexing are part of the runtime contract.

Builtins

Expose a real language surface, not a tiny demo core.

miniR already ships hundreds of builtins across math, strings, IO, graphics, packages, and diagnostics, all registered from Rust.

Diagnostics

Make failure modes easier to debug than in GNU R.

Tracebacks, native backtraces, and more specific error messages are part of the design philosophy.

Subsystem Guides

Read the parser, embedding API, and help pipeline as first-class parts of the runtime.

miniR is not only an evaluator. The front end, host-facing session boundary, and documentation machinery are separate subsystems with their own design constraints.

Documentation

Start with the guides, then drop into the reference manual when you need exact behavior.

Open the full manual
Reference 6 pages

User Manual

Generated from repo docs and ordered as a reference path through divergences, package runtime, graphics, native internals, and focused implementation notes.

Guide Top level

Getting Started

Installation, build profiles, and first steps

Guide Top level

Interpreter Architecture

How parser, evaluator, runtime values, dispatch, and package layers fit together

Guide Top level

Reentrant Runtime

What reentrancy means in miniR, which state lives on `Interpreter`, and why the project avoids process-global runtime state

Guide Top level

Builtins

How miniR's 800+ builtins register, how the builtin macros differ, and when a missing behavior is not actually a builtin problem

Guide Top level

The Interpreter

How `Session`, `Interpreter`, `eval_in`, environments, promises, and builtin dispatch fit together during evaluation

Guide Top level

Feature Flags And Build Profiles

What miniR's optional features do, how build profiles compose them, and how the project stays usable for minimal and WASM-oriented builds

Guide Top level

Package Runtime

How miniR finds packages, loads namespaces, sources R files, and attaches exports

Guide Top level

Builtin Registry And linkme

How `linkme` distributed slices collect builtin descriptors, why miniR uses that pattern, and why it blocks WASM today

Guide Top level

S3 And S4

How miniR handles S3 dispatch in the evaluator and S4 registries in the runtime

Guide Top level

WASM Support

How miniR's feature layout supports wasm-friendly builds, what the current blocker is, and which subsystems are intentionally left out of a WASM target

Guide Top level

Graphics And Devices

How base graphics, grid graphics, file devices, and the optional GUI fit together

Guide Top level

Parser And Diagnostics

How miniR parses R source with pest, builds the AST, and turns parse failures into better diagnostics than raw grammar errors

Guide Top level

Session API And Embedding

How `Session` wraps `Interpreter`, why it is the public entry point, and what embedding-oriented helpers it exposes

Guide Top level

CRAN Corpus Compatibility

Compatibility numbers for the checked-in `cran/` corpus, not the full CRAN archive

Guide Top level

Stack Traces And Backtraces

How miniR captures R tracebacks, file-and-line locations, and native backtraces across `.Call` boundaries

Guide Top level

Native Code Support

C, C++, and Fortran compilation for R packages

Guide Top level

Native Runtime

The R C API surface compiled into miniR, callback plumbing, and native-call execution

Guide Top level

Divergences from GNU R

Intentional differences from GNU R's behavior

Guide Top level

Help And Documentation

How `?topic`, package `man/` indexes, builtin rustdoc, and generated `.Rd` files fit together in miniR's help pipeline