Write formal YABNF grammar specification #1

Open
opened 2026-08-07 14:24:31 +00:00 by hum3 · 0 comments
Owner

Goal

Define the YABNF syntax formally in ABNF-of-ABNF style, so that parsers can be built from the spec.

Scope

  1. Shared terminals — reuse/extend RFC 5234 core rules
  2. Grammar-level directives (7) — @grammar, @word, @extras, @inline, @conflicts, @externals, @supertypes
  3. Rule-level annotations (9) — @prec, @prec-left, @prec-right, @prec-dynamic, @field, @alias, @token, @immediate-token, @pattern
  4. Delta from standard ABNF — underscore in rule names, @ prefix syntax
  5. Precedences gap — define a @precedences directive for the top-level precedences array in grammar.json (currently unrepresented)

Context

  • All 16 extensions audited and confirmed load-bearing (see README)
  • Motivated by tree-sitter2abnf#2 — this spec will be the reference for extending tree-sitter2abnf output and for building a tree-sitter YABNF parser

Deliverable

A spec.abnf (or similar) file defining the YABNF grammar, plus documentation of the semantics of each extension.


Migrated from Codeberg: originally #1, opened 2026-03-18.

## Goal Define the YABNF syntax formally in ABNF-of-ABNF style, so that parsers can be built from the spec. ## Scope 1. **Shared terminals** — reuse/extend RFC 5234 core rules 2. **Grammar-level directives** (7) — `@grammar`, `@word`, `@extras`, `@inline`, `@conflicts`, `@externals`, `@supertypes` 3. **Rule-level annotations** (9) — `@prec`, `@prec-left`, `@prec-right`, `@prec-dynamic`, `@field`, `@alias`, `@token`, `@immediate-token`, `@pattern` 4. **Delta from standard ABNF** — underscore in rule names, `@` prefix syntax 5. **Precedences gap** — define a `@precedences` directive for the top-level `precedences` array in grammar.json (currently unrepresented) ## Context - All 16 extensions audited and confirmed load-bearing (see README) - Motivated by [tree-sitter2abnf#2](https://codeberg.org/hum3/tree-sitter2abnf/issues/2) — this spec will be the reference for extending tree-sitter2abnf output and for building a tree-sitter YABNF parser ## Deliverable A `spec.abnf` (or similar) file defining the YABNF grammar, plus documentation of the semantics of each extension. --- *Migrated from Codeberg: originally [#1](https://codeberg.org/hum3/tree-sitter-yabnf/issues/1), opened 2026-03-18.*
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
hum3/tree-sitter-yabnf#1
No description provided.