tree-sitter-abnf

Tree-sitter grammar for ABNF (Augmented BNF for Syntax Specifications).

Implements RFC 5234 and RFC 7405 (case-sensitive string support).

Features

  • Full RFC 5234 ABNF syntax: rules, alternation, concatenation, repetition, groups, options
  • RFC 7405 case-sensitive (%s"...") and case-insensitive (%i"...") strings
  • Numeric values: binary (%b), decimal (%d), hex (%x) with concatenation (.) and ranges (-)
  • Prose values (<...>)
  • Continuation lines (newline + indent continues a rule)
  • Core rulenames (ALPHA, DIGIT, etc.) as a distinct node type for highlighting
  • Accepts both LF and CRLF line endings