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.
A distributed-system compiler built on Quilt. Describe an entire system — services, databases, events — in one .arch file, and it generates the whole thing: Rust and Python services, SQL schemas, clients, tests, docs, and a Nix deployment.
Looking for more? Browse the annotated .quilt examples in the quilt repo →
Supported Languages
Generated from Quilt’s conformance suite — every cell is a passing test. Hover for details. Full matrix →
| Language | Object | Meta | Lift in | Emit ← | Runtime |
|---|---|---|---|---|---|
| Bash | ✅ | ✅ | 🟡 | ⬜ | ⬜ |
| HTML | ✅ | ⬜ | 🟡 | ⬜ | ⬜ |
| Lean 4 | ✅ | ✅ | ✅ | 🔵 | 🔵 |
| Nix | ✅ | ✅ | ✅ | 🟡 | 🔵 |
| Python | ✅ | ✅ | ✅ | ⬜ | ✅ |
| Rust | ✅ | ✅ | ✅ | ✅ | ✅ |
| SQL | ✅ | ⬜ | ✅ | ⬜ | ⬜ |
| Plain text | ✅ | ⬜ | 🔵 | ⬜ | ⬜ |
| TypeScript | ✅ | ✅ | 🔵 | ⬜ | ✅ |
| WGSL | ✅ | ⬜ | 🟡 | ⬜ | ⬜ |
| Zsh | ✅ | ✅ | 🟡 | ⬜ | ⬜ |
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.