plum

#treesitter#compiler#wasm

git clone https://git.pyrossh.dev/plum

A statically typed, imperative programming language inspired by rust, python


0ccc80d — Peter John 2026-11-13T19:31:56+05:30
nothing global, `const`: loader: a top-level `fun` other than `main` (and an `export fun`, the host's entry point), a top-level `extern fun` and a top-level constant are errors ("`f` is a top-level function, and nothing is global but `main`: move `f` into a `primitive`, `struct`, `enum` or `trait` and call it as a static (`Type.f(..)`)"); a constant is `const Name = value` in a type's body (grammar: optional `const` keyword, so the bare `Name = value` parses and is an error asking for `const`), highlights/format queries, LSP keywords and doc-block items, vscode grammar; every static value in std, examples, tests, benchmarks and fixtures is a `const` (171), the top-level constants left in tests/ and the game fixtures moved into their types (`MathEdgesTest.Inf`, `P.Origin`, `Crate.Base`, `Run.Start`, ..), the game fixtures' `page` upcast is a typed local; module fixtures mathx, shapes, Palette, hue, tint and constants are namespaces (`Mathx.clamp`, `Palette.Dark`, `Hue.code`, `Constants.Third`) and modules_tests is about them (the module-function rules have nothing left to name); tail_calls and closure_tail_call_runs pass the static again (`TailCallsTest.goClosure`); checker: a generic or extern static as a value is an error like a free fn's (it passed the checker and failed in codegen), a static call checks an unpinned generic of its own like a free call (`Links.len(Nil)`), an undefined call suggests the enclosing type's statics; uniqueness: a static's calls get `$unique` versions (its receiver is its type) and a dropped version's calls are renamed back by type (the games broke otherwise), a static named as a value escapes (it was proved unique); reuse: statics are candidates and `T.f` as a value disqualifies; closure_spec: a static value is the closure `|a| T.f(a)`, so it is specialised like a free fn name; LSP: go to definition of a bare sibling static call; about 1,360 top-level funs in the compiler's inline programs (86 Rust files: checker, core, codegen, driver, cli, lsp, game tests and src unit tests) are statics of `primitive Main` or of a namespace named after a shared prelude (`Pre.show`, `CellFns.bump`, `ListFns.mapList`), callers and assertions on names, labels and positions updated, name lookups made to fail on a missing fn (`newsIn`, `proved`, `provedFn`) so a renamed fn can't pass vacuously; the generated game entry (`gameUpdate`/`gameDraw`) stays free in the uniqueness tests that simulate it, parser.rs's grammar-only tests keep top-level funs; tree-sitter corpus and highlight sample in the new form; docs (language.md: every sample, the rule, `const`, extern statics, tests sample; README; performance.md)

This diff is too large to display.