Metaprogramming
across every language.

Quilt lets metaprograms in any language generate and manipulate code in any other language using standardized arrow glyphs.

Five Operators. Any Language.

The entire system is built on five Unicode glyphs that compose cleanly across language boundaries.

Quote
lang

Captures a foreign-language code fragment as a first-class QTerm value. The language annotation (python, html, wgsl…) is optional; omitting it defaults to the host language.

Unquote
expr

Splices a computed term back into a quote. The content is ground-language code evaluated at generation time, producing a QTerm to substitute at the hole position.

Lift
value.  /  (value)

Converts a runtime value into a QTerm. Integers become integer literals, strings become string literals, Vec becomes a Python list literal, and so on — the target language shapes the output.

Reduce
expr.  /  (expr)

Evaluates a QTerm at generation time by compiling and running it (via rust-script for Rust), then deserializing the result. Enables staged computation where one program generates and immediately evaluates another.

Emit
term.  /  (term)

Appends a term into the surrounding variadic block, such as a Rust { } or Python function body. Enables loops that build programs one statement at a time.

Example

A Rust program that generates Python. The squares are computed at generation time in Rust; the emitted Python contains only the results.

squares.py.rs.quilt
#!/usr/bin/env quilt
use quilt::prelude::*;

fn main() -> Result<()> {
    // Runs at generation time, in Rust.
    let squares: Vec<u64> =
        (1..=5).map(|n| n * n).collect();

    let program = python
        def main():
            squares = squares.
            print(squares)

        main()
    ;

    println!("{}", program.coparse());
    Ok(())
}
squares.py  (generated)
def main():
    squares = [1, 4, 9, 16, 25]
    print(squares)

main()

Supported Languages

Languages with Meta support can drive generation; Object languages can be quoted and spliced into. The Meta and Object checkmarks link to each language’s MetaLanguage and Language implementations; Bindings link to the published runtime package.

LanguageMetaObjectBindingsNotes
RustPrimary host. Full MetaLanguage support. Generated from mk_meta.rs.quilt by bootstrap.
PythonSecond host language. PyO3 runtime module provides the same QTerm API in Python.
TypeScriptMeta language behind the browser playground. The expander rewrites .ts.quilt quotes into plain TypeScript that calls the quilt-wasm runtime.
HTMLQuote and splice HTML document fragments for code-generated web reports and templates.
WGSLGenerate GPU shader code at build time. Lift Rust values directly into WGSL literal syntax.
ZshGenerate shell scripts with correct quoting. Rust strings lift into properly escaped zsh words.
BashSame as Zsh — a separate target with Bash-specific quoting semantics.
NixGenerate Nix expressions — derivations, flakes, modules — at build time, or use Nix as a host: its string-based meta turns a .nix.quilt metaprogram into plain Nix, mapping unquotes onto Nix’s own ${} interpolation.
More languages coming soon…

Tooling

Real IDE features for polyglot .quilt files.

quilt-lsp — the language server

A multiplexing server: it parses a .quilt file’s structure, projects each embedded language into its own virtual document, and proxies to the real downstream server — rust-analyzer for Rust, pyright for Python — remapping positions both ways. You get hover, go-to-definition, completion, and diagnostics from the tools you already trust, right inside the quilt.

Glyph keyboard shortcuts

Quilt’s operators are Unicode glyphs — but you never have to hunt for them. The VS Code extension binds a chord shortcut to every operator, and a drop-in macOS DefaultKeyBinding.dict maps Command-plus-arrow chords to the glyphs system-wide, so are as quick to type as any bracket.

VS Code extension

An extension bundling the language server and the .quilt grammar for syntax highlighting — so the whole experience works out of the box. Install it straight from the VS Code Marketplace.

Design Tenets

The principles behind every design decision in Quilt.

Tenet 01
Meta-programming is everywhere.

Macro systems, web development frameworks, build scripts — many tasks in software development and maintenance can be considered meta-programming. These tasks are often awkward and error-prone because they stray from the tools and guarantees of normal languages. We embrace meta-programming as a necessary evil and build tools to address these pain points.

Tenet 02
Meta-programming should be representation-agnostic.

We don’t write programs by constructing syntax trees, so we shouldn’t have to do so when writing meta-programs. Languages already expose textual syntax as their primary interface, so we avoid expanding their surface areas with tree-like representations — letting each meta-language implementation freely choose the data structures used to represent code behind the scenes.

Tenet 03
Meta-programming should be language-agnostic.

Languages shouldn’t force a single meta-language upon users, making them learn a whole new language for such purposes. Users should be able to choose whichever meta-language best fits the job at hand, as we do when choosing a normal language or framework. Standardizing the syntax for stitching languages together can make it easier to switch between languages.