Squiggle logoSquiggle
Internal

Grammar

Peggy grammar

The source of truth for Squiggle's syntax is Peggy grammar, defined in this file.

The grammar is used to generate Squiggle's parser, which is used to parse Squiggle code into an abstract syntax tree (AST).

Bugs

Open bugs and feature requests for the grammar are tracked in GitHub issues.

Lezer grammar

In Squiggle editor, we use Lezer to highlight Squiggle code.

Lezer grammar is defined in this file.

Lezer grammar is not authoritative for Squiggle syntax. It tries to replicate the syntax of the Peggy grammar, but Peggy grammar contains a few ambiguities that are hard to replicate in Lezer.

On this page