FormaLang

A complete compiler frontend, inside your application.

FormaLang parses, checks and resolves a small, statically typed, declarative language, and hands you the result as a fully resolved IrModule. You bring the backend: an interpreter, a JIT, a query engine, a code generator. No runtime, no I/O, no global state, so it fits anywhere: a server, a database, a browser, an editor.

The playground on this page is that frontend, built for wasm32, in your browser.

Features

The whole frontend

Lexer, parser, semantic analysis and IR lowering, in one call: compile_to_ir. Every type, name, call target and overload comes back resolved. Errors come back as data, each with its code and its place in the source, and render as readable reports.

Embeds anywhere

No runtime, no I/O, no global state. Modules arrive through a resolver: from disk, from memory, or from your own store. It builds for native hosts and for wasm32, so the same frontend lives in a database, a server or a browser tab.

Any backend

Run the IR, answer a query with it, or emit code from it. Chain IrPass transforms and finish with a Backend. Built in: monomorphisation, closure conversion, defunctionalisation, dead-code elimination and constant folding.

Types, settled at load

Structs, enums with data, traits, generics with bounds, and optionals with T?. A match must cover every variant. A broken program never reaches your backend.

Built for large data

A for gives a lazy Seq, consumed exactly once through map, filter, fold. A query over host data makes one pass, and its memory does not grow with the input.

Secure by design

A program touches the world only through extern fn and extern impl, which your application declares and provides. The frontend checks every call against them.