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.
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.
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.
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.
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.
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.
#!/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(())
}def main():
squares = [1, 4, 9, 16, 25]
print(squares)
main()See It in Action
Real projects built with Quilt.
Edit a .html.ts.quilt source and watch Quilt’s parser and expander — compiled to WebAssembly — turn it into TypeScript and render the result, entirely in the browser.
A gas-metered state-machine toolchain that uses Quilt to generate GPU-friendly WGSL and HTML at build time.
Annotated .quilt files covering the core operators, cross-language generation, and lifted values.
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.
| Language | Meta | Object | Bindings | Notes |
|---|---|---|---|---|
| Rust | ✓ | ✓ | ✓ | Primary host. Full MetaLanguage support. Generated from mk_meta.rs.quilt by bootstrap. |
| Python | ✓ | ✓ | ✓ | Second host language. PyO3 runtime module provides the same QTerm API in Python. |
| TypeScript | ✓ | ✓ | ✓ | Meta language behind the browser playground. The expander rewrites .ts.quilt quotes into plain TypeScript that calls the quilt-wasm runtime. |
| HTML | — | ✓ | — | Quote and splice HTML document fragments for code-generated web reports and templates. |
| WGSL | — | ✓ | — | Generate GPU shader code at build time. Lift Rust values directly into WGSL literal syntax. |
| Zsh | — | ✓ | — | Generate shell scripts with correct quoting. Rust strings lift into properly escaped zsh words. |
| Bash | — | ✓ | — | Same as Zsh — a separate target with Bash-specific quoting semantics. |
| Nix | ✓ | ✓ | — | Generate 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.
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.
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.
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.
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.
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.
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.