meta-language

A self-describing links network for lossless language representation.

Parse source from dozens of languages into one uniform, byte-for-byte reconstructible graph — then query, transform, and reconstruct it across languages. Written in Rust.

crates.io docs license

What is it?

meta-language is a Rust crate that represents code and data as a single links network: every token, syntax node, field label, and relation is just a link with ordered references to other links. The parse is lossless — every byte of the source is preserved, so the original text can be reconstructed exactly — while the same network can be projected as concrete syntax, abstract syntax, or semantics-only views.

Because the model is self-describing, the same substrate works for source code (via tree-sitter grammars), natural language, structured data formats, and documents — and supports cross-language reconstruction, codemod-style queries, incremental reparsing, and snapshots.

Features

Lossless parsing

Every byte is preserved. reconstruct_text() rebuilds the source exactly from the network.

One uniform model

Tokens, nodes, fields, and relations are all links — no side tables, no special primitives.

Many languages

Backed by tree-sitter grammars for C, C++, C#, Go, Java, JavaScript, Python, Rust, and many more.

Projections

View the same network as concrete syntax, abstract syntax, or semantics-only data.

Query & transform

S-expression-style queries with captures, plus find()/replace() codemods.

Incremental & versioned

Stable link ids across edits, immutable snapshots, editable forks, and provenance.

Interactive demo — Links Notation playground

The meta language serializes its network as links notation — the structural substrate of the whole model. This playground parses links notation entirely in your browser via WebAssembly (compiled from the same Rust links-notation crate the project uses). Type below and watch it parse live.

Loading WebAssembly…

          

Runs offline — no network calls. Source: web/.

Example: the self-description

The network can describe itself. Running meta-language describe prints the built-in self-description roots in links notation — the same format the demo above understands:

(link: reference reference)
(reference: link link)
(relation link: link reference)
(language: grammar concept)
(grammar: language relation link)
(type: Type concept)
(concept: link language)
(point: point point)
(field: relation link reference)

Quick start

Add the crate

cargo add meta-language

Use the library

use meta_language::{LinkNetwork, ParseConfiguration};

let network = LinkNetwork::parse("fn main() {}", "rust", ParseConfiguration::default());
let report = network.verify_full_match(None);
assert!(report.is_clean());

// Byte-for-byte reconstruction of the original source.
assert_eq!(network.reconstruct_text(), "fn main() {}");

Use the CLI

# Print the built-in self-description roots
meta-language describe

# Parse text and verify the parse is lossless and clean
meta-language verify --language rust --text 'fn main() {}'

Documentation & resources