PatLang All Paradigms Demo
Recursion, control flow, lists, events (when/emit), logic (fact/query), OO (new/send/get), and functional map/filter via apply .
PatLang programming language, self-hosted compiler, and interactive portfolio.
Recursion, control flow, lists, events (when/emit), logic (fact/query), OO (new/send/get), and functional map/filter via apply .
fib(27), a 2-million iteration loop, and a 200k-element vector build, each reporting its own elapsed milliseconds.
The self-hosted PatLang compiler (lexer, parser, lowerer) compiled to WebAssembly. Edit the program, press Run: your source is tokenized, parsed, and lowered by PatLang code running in this page, then executed on the…
A checkout session as a stream of scan / pay events: the product catalog lives in the object store, and a dairy fact drives the discount rule.
PatLang's own self-hosted Gherkin-style BDD framework ( lib/test.patlang : t_init / check / step / run_feature_tagged ), running against the point of sale: unit assertions, event-driven integration checks, and a Gherkin…
require checks a precondition, ensure a postcondition, and assert is the same primitive used standalone — all three lower to one contract_check host call, enforced identically whether interpreted, run here via WASM (no…
Ordinary Int arithmetic stays on the fast path until it can't: factorial(30) overflows a 64-bit integer partway through and the runtime silently promotes to an exact, arbitrary-precision BigInt — no annotation, no…
A small grammar extension declared entirely in PatLang source ( syntax RouterDSL { trigger; tokens { ... }; rule { ... } } ), matching HTTP-verb/URL-path tokens with a general-purpose regex engine also written in…
The DSL page above declares its syntax { ... } block as a literal, expanded once before the compiler ever runs — indistinguishable from a macro. This one instead computes its trigger keyword and rules from data at…
Writing the abstract requires every other section to exist first, and several sections have real sub-tasks of their own (running experiments, gathering data, and analysing it are separate delegated tasks). Each task is…
Driven by a manifest file ( self_hosting/patbuild.manifest ):
The same control-flow-graph recovery as the flowgraph CLI tool ( flowgraph <output.html> [inputs...] , source below), running live: paste a program, press Render, and see basic blocks and jump edges recovered from the…
PatLang computing data (a fibonacci table) and generating a well-formed, interactive HTML+JS page around it — the browser as PatLang's cross-platform GUI. Running live below: the iframe is the actual page this PatLang…
The self-hosted compiler front+middle end processing its own complete source (289918 chars), run under the Stage 0 interpreter while building this page:
A self-hosted Ruby transpiler ( lib/transpile_ruby.patlang ) walking the PRE-LOWERING AST directly (real if / while / def already present, unlike the flattened jump-based IR the ordinary compiler produces) to emit…
A grid compiled into logic-programming fact s, solved by a recursive depth-first search driven by query , announced with goal , and reported through a solved / unsolved event - generation and solving both run live in…
The self-hosted compiler (lexer, parser, lowerer), compiled to WebAssembly once and reused for every run in this page. Run executes your program; Tokens and AST show the compiler's own intermediate representations for…
Basic blocks and jump edges recovered from the self-hosted compiler's own IR, one section per program. Red curves are conditional (JumpIfFalse), blue are unconditional.
parallel_map(items, "func_name") spawns one real OS thread per item (via Rust's std::thread::scope ) and runs func_name(item) on each concurrently — genuine parallelism, mirrored byte-for-byte into the compiled-native…
Ruby-style cooperative coroutines ( fiber_new / fiber_resume / fiber_yield / fiber_alive ), implemented on real OS threads under the hood but never actually running concurrently: a mutex+condvar pair ( ir/fiber.rs )…