Source

Gibberish is a parser combinator language and compiler designed to produce lossless syntax trees (LSTs) with robust, structured error recovery. It is built for tooling use-cases such as IDEs, language servers, formatters, and linters—where incomplete or incorrect source code must still be parsed meaningfully.

Unlike traditional parser combinator libraries that fail fast and discard structure on errors, Gibberish always produces a tree. Missing and unexpected syntax is represented explicitly, making it possible to reason about and recover from errors without backtracking or global failure.

Getting Started

Prerequisites

Gibberish builds a C library and many of the commands rely on cc being present on the PATH.
For windows you'll need CL.

Note
Depending on a C compiler already seems like it's going to be a pain.
There's likely a lot configuations which won't work under the current setup.
However if this is the case you can generate the C instead, compile it to a shared lib and
point the gibberish CLI to that instead.
I think my plan is to build a Gibberish runtime for when you exeucte 'lex', 'parse', 'watch' etc
to avoid these struggles.
I'm hoping the current implementation is enough to demo the core ideas of the combinators.

Installing the Compiler

Prebuilt binaries are available on the GitHub Releases page.

Building from source

git clone https://github.com/mnbjhu/gibberish
cd gibberish
cargo install --path crates/gibberish

Trying an Example Grammar

The fastest way to understand Gibberish is to look at and run the example grammars.

Examples live in:

docs/examples/

For example, the JSON grammar can be parsed and tested against an input file:

gibberish parse docs/examples/test.json --parser docs/examples/json.gib

This will print the lossless syntax tree, including structure, skipped tokens, and explicit error nodes.

Common Workflows

Lex a file

gibberish lex input.txt

Parse a file and inspect the tree

gibberish parse input.txt --parser grammar.gib

Hide tokens or errors for readability

gibberish parse input.txt --hide-tokens
gibberish parse input.txt --hide-errors

Watch a file while editing

gibberish watch input.txt --parser grammar.gib

This is especially useful when developing or debugging grammars.


Key Features


The Gibberish Compiler CLI

The Gibberish compiler provides a set of tools for working with grammars and source files.

Commands

gibberish lex <src> [--parser <parser>]
gibberish parse <path> [--hide-errors] [--hide-tokens] [--parser <parser>]
gibberish watch <path> [--hide-errors] [--hide-tokens] [--parser <parser>]
gibberish build <path> --output <output>
gibberish generate <path>
gibberish lsp

What Makes Gibberish Different?

Most parser combinator systems revolve around success vs failure. Gibberish instead models parsing as commitment and local recovery:

This allows Gibberish to recover gracefully from deeply broken input while still producing a meaningful, navigable tree.

Documentation (Early & Evolving)

The documentation reflects the current implementation but is still early-stage and evolving. Expect rough edges and underspecified areas.

The following documents capture the core ideas accurately:

Status

Gibberish is under active development.

If something feels underspecified, it probably is—feedback and experimentation are encouraged.


Tags: langdev   parser   parser combinator  

Last modified 22 March 2026