A workbench for theory-of-computation students: build automata, check your answers, train in the dojo. https://rgxr.yhkze.net
  • Rust 32.7%
  • TypeScript 25.3%
  • Svelte 17.3%
  • CSS 8.3%
  • HTML 8%
  • Other 8.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
yuuhikaze b415a204b5
All checks were successful
ci / image (rust:1-slim-bookworm=docker-image://git.yhkze.net/actions/rust:1-slim-bookworm debian:bookworm-slim=docker-image://git.yhkze.net/actions/debian:bookworm-slim , ., api.Dockerfile, rgxr-api) (push) Successful in 5m16s
ci / rust (push) Successful in 4m12s
ci / web (push) Successful in 1m24s
ci / image (oven/bun:1.4.2-debian=docker-image://git.yhkze.net/actions/bun:1.4.2-debian node:22-bookworm-slim=docker-image://git.yhkze.net/actions/node:22-bookworm-slim , web, web.Dockerfile, rgxr-web) (push) Successful in 2m30s
docs(operations): postgres on cloudnativepg with rgw backups
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q7bU4JSq7aBvoTSXG3q6fG
2026-11-15 20:40:18 -05:00
.forgejo/workflows docs: rewrite README and docs/ to the canonical layout 2026-10-25 03:18:27 -05:00
.tern chore(docs): commit the generated tern store ignore 2026-11-15 18:03:07 -05:00
crates feat(api): keep saved documents for signed-in users only 2026-11-15 18:45:32 -05:00
docs docs(operations): postgres on cloudnativepg with rgw backups 2026-11-15 20:40:18 -05:00
docs-html docs(operations): postgres on cloudnativepg with rgw backups 2026-11-15 20:40:18 -05:00
migrations docs: replace agent-coordination docs with reference/development guides 2026-10-24 19:02:21 -05:00
resources/images docs: re-capture screens at 2x for readability (#77) 2026-10-25 04:11:47 -05:00
web fix(web): finish a sign-in in whichever tab the provider returns to 2026-11-15 19:39:39 -05:00
.dockerignore docs: rewrite README and docs/ to the canonical layout 2026-10-25 03:18:27 -05:00
.gitignore docs: tern docs pipeline, merged dev-shell flake, UI design direction 2026-10-23 18:36:03 -05:00
api.Dockerfile docs: rewrite README and docs/ to the canonical layout 2026-10-25 03:18:27 -05:00
Cargo.lock feat(api): verify oidc bearer tokens instead of forward-auth headers 2026-11-15 14:15:21 -05:00
Cargo.toml docs: replace agent-coordination docs with reference/development guides 2026-10-24 19:02:21 -05:00
flake.lock chore: pin tern to the v2.1.0 release tag 2026-11-07 12:44:19 -05:00
flake.nix chore: pin tern to the v2.1.0 release tag 2026-11-07 12:44:19 -05:00
LICENSE bootstrap: contracts, workspace scaffold, and build board 2026-10-23 18:14:39 -05:00
openapi.yaml feat(api): keep saved documents for signed-in users only 2026-11-15 18:45:32 -05:00
README.md docs: oidc auth model and supa choi 2026-11-15 14:15:21 -05:00
web.Dockerfile docs: rewrite README and docs/ to the canonical layout 2026-10-25 03:18:27 -05:00

rgxr

A workbench for the theory of computation: draw automata on an infinite canvas or write them as text, run words through them with step-by-step traces, work the algebra, and drill everything in the dojo. A lightbulb in any section's top bar has the sensei walk you through it, live. Anonymous by default (no login required), self-hostable by anyone, with optional sign-in through any OpenID Connect provider if you want accounts.

What it does

  • Automata editor: an infinite canvas with drag-and-drop states and transitions, plus a text DSL to type the machine instead of drawing it. Both views edit the same automaton.
  • Word running: run a word against a DFA or NFA and get a step-by-step trace of the epsilon-closed active states; Turing machines play the tape back, head and all, after every step.
  • The algebra (OPS): determinize, minimize, complement, and products (union, intersection, difference). Table-filling shows you why two states are (in)equivalent.
  • Regex ⇄ automaton: regex to NFA (Thompson) and automaton back to regex (state elimination), both directions checked by the engine.
  • Context-free grammars: CNF conversion, chart parsing, parse trees, and PDA ⇄ CFG conversion.
  • PDAs and Turing machines: multi-tape (up to four) and nondeterministic, with configuration search and step playback.
  • Render and export: graphviz SVG for anything you build, LaTeX (TikZ) export for your documents.
  • Saved documents: automata, grammars and machines persist in Postgres, scoped per user.
  • The dojo: problems graded by the engine itself, never by a model. The LLM sensei ("Supa Choi") composes fresh problems and comments on your answers; offline scrolls work with no setup at all.
  • Per-section tutorials: a lightbulb in the top bar docks the sensei next to the live UI and he walks you through the section: theory first, then the controls, including [ SHOW ME ] steps where the app fills inputs and presses buttons in front of you. You learn the theory while using the tool, with no prior course required.
  • English and Spanish throughout, with Japanese flavor.
  • Retro CRT terminal aesthetic: pure black, monospace, one accent color.

Screens

Editor + run trace Render (graphviz SVG)
Editor canvas running (a|b)*abb with the epsilon-closed trace Render preview of the Thompson NFA
OPS algebra (minimized DFA) TM tape with playback
Table-filling minimization result on OPS Turing machine tape with head and playback
Grammars (parse tree) Dojo (training menu)
Grammar membership with parse tree and derivation Dojo menu with the sensei

Documentation

The documentation index links every page:

  • Reference: the normative contract (Fa wire format, derived-state naming, auth model, saved documents, trace semantics, regex syntax, limits, env vars, error envelope)
  • Operations: images, promotion lanes, environments, secrets and auth headers
  • Design notes: the retro-terminal UI direction
  • The dojo and the sensei: problem sources, LLM brains, minimum model
  • Development: toolchain, quick start, the no-unwrap policy, docs rendering, CI and commit conventions

Quick start

nix develop                    # tern, pandoc, bun, graphviz, latex, jq/yq, openbao

docker run -d --name rgxr-pg -p 5432:5432 \
  -e POSTGRES_USER=rgxr -e POSTGRES_PASSWORD=rgxr -e POSTGRES_DB=rgxr \
  postgres:17-alpine

DATABASE_URL=postgres://rgxr:rgxr@localhost:5432/rgxr \
RGXR_DEV_MODE=true cargo run -p rgxr-api
# api: http://localhost:8080/healthz · Swagger: http://localhost:8080/api-docs

cd web && bun install && bun run dev
# web: http://localhost:5173 (proxies /api → :8080)

RGXR_DEV_MODE=true serves requests without a token as anonymous; migrations apply automatically at API startup.

Architecture

The application is three pieces:

flowchart TB
    B["Browser — SvelteKit SPA"] --> W["rgxr-web — SvelteKit (adapter-node)"]
    W -->|"/api"| A["rgxr-api — axum, stateless"]
    A --> P[("Postgres — jsonb documents, per-user scoping")]
    IDP["OIDC provider — optional sign-in"] -.->|"access token (PKCE)"| B
    B -.->|"Authorization: Bearer, else anonymous"| A

Signing in is optional: the browser gets an access token from any OpenID Connect provider and the API verifies it; without one, every request is the anonymous user. The sensei talks to any OpenAI-compatible endpoint and needs an API key (yours, entered in the browser); rendering shells out to graphviz, optionally with a LaTeX toolchain for TikZ export.

Repository layout

crates/rgxr-core     Pure automata engine (no IO): run, ops, regex, grammars, PDA/TM, grading
crates/rgxr-render   DOT generation + render pipeline (graphviz / LaTeX)
crates/rgxr-api      axum + sqlx HTTP API
web/                 SvelteKit frontend
openapi.yaml         THE API contract — every consumer/producer derives from it
migrations/          sqlx migrations, applied at API startup
docs/ + docs-html/   Documentation source and the tern-compiled HTML
resources/images/    Captures used by this README and the docs

Docs build

The documentation (this README and docs/) compiles to docs-html/ with:

nix develop -c tern --update   # once, or after changing .tern/config.toml
nix develop -c tern

License

MIT