a compiled, typed programming language

grapheme.in development

A language for simulating graphs with author-defined forces, drawings, cameras, and constraints. GPU-native, cross-platform, type-safe, embeddable. The same compiler that runs on a desktop runs in your browser via WebAssembly + WebGPU.

example programs

Embedded right here in your browser via WebAssembly + WebGPU.

  1. 01 solar_system.grapheme

    Solar system

    eight planets, Newtonian gravity

  2. 02 water.grapheme

    Water molecule

    bond angle from Coulomb forces alone

  3. 03 fractal_chart.grapheme

    Fractal chart

    fractals as nodes, relationships as typed edges

what is grapheme

Forces

User-defined functions on nodes. Author writes the physics.

Drawings

Nodes can look like anything the user wants to express through mathematics.

Constraints

Rules that must hold between nodes, for example the rigid distance between two bonded atoms. Solved each tick by built-in solvers: XPBD, LINCS, SHAKE.

Typed edges

Multiple types per graph; the author chooses how each one behaves.

Generic precision

Pick one of nine (float16 through emulated float128, plus five fixed-point variants) and the entire codebase computes at that precision. Arbitrarily accurate within the limits of computer arithmetic.

Three dimensions

Every position, velocity, and force is Vec3, even when most graphs sit in 2D. Depth is a free axis the author can use.

Interactive

Cameras with input bindings, on-event handlers, live 60 Hz tick loop.

GPU-native, cross-platform

Almost everything compiles to GPU shaders through wgpu. Runs in any browser with a GPU, or natively on Mac, Linux, and Windows.

a force, in source
def force gravity(g: Float) -> Vec3 {
    fn(n: Node) -> Vec3 {
        vec3(0.0, -g, 0.0)
    }
}
  1. 01 declares itself as gravity, taking a strength parameter g
  2. 02 says it applies to every node it's activated on (fn(n: Node))
  3. 03 returns a vector for each node (-> Vec3)
  4. 04 that vector is (0, -g, 0): zero horizontally, downward by g, zero in depth
principles
  1. 01

    Author expressibility

    Authors should be able to write whatever they can think of and express with mathematics.

  2. 02

    Performance

    Real-time simulation at scale. GPU-native execution from end to end.

  3. 03

    Precision

    Precise enough to simulate at a scientific level. Forces are functions; the precision they compute at is the author's choice, applied uniformly across the entire codebase.

  4. 04

    Cross-platform

    The same .grapheme file runs in any browser with a GPU, or natively on Mac, Linux, and Windows.

  5. 05

    Compositionality

    Forces, drawings, constraints, and cameras compose freely. The author writes pieces; the runtime glues them.

  6. 06

    Transparency

    Every shader is derived from an author body. No hidden runtime behavior.

  7. 07

    Type safety

    A wrong-precision pipeline is a compile-time error, never a runtime bug.

  8. 08

    Embeddability

    Drop a .grapheme program into any host: HTML, Obsidian, SliDev, mdBook.

Ethan Voraritskul · grapheme is in active development / 2026