Library

Reference / Cheat Sheet

Written by dbalabs | Mar 10, 2026 7:44:43 PM

This page is the compact reminder for grammar authors, reviewers, and implementers. Use it when you already know the model and need the exact rules quickly.

Fast rule of thumb: exact phrases, exact delimiters, exact macro names, and only one repetition operator.

Core symbols

  • UPPERCASE WORDS — exact keyword phrases.
  • parameterName — value capture.
  • [ ... ] — optional group.
  • { ... } — required group.
  • | — alternatives inside the current group.
  • ... — repetition suffix on the immediately preceding node.
  • ${macroName} — canonical macro reference.
  • <macroName> — legacy macro reference when preserved for compatibility.
  • ., ;, ,, : and similar punctuation — literal delimiters.

Runtime rules

  • Keywords match user input case-insensitively.
  • Macro names match the registry case-sensitively.
  • Parameters consume one WORD or STRING token unless repetition or macro expansion says otherwise.
  • Quoted values bind their normalized semantic value without outer quotes.
  • Repeated matching must preserve the rest of the grammar. It cannot swallow later clauses.
  • Full-input matching is required for success.
  • The first fully matching registered command wins.

Binding rules

  • Captures are ordered as (name, context, value).
  • Exact keyword phrases matter for clause detection and after-style context filters.
  • Repeated field binding ends with the last matching value.
  • Repeated method binding is invoked once per capture, in encounter order.
  • Clause fields are false when absent and true when present.

Invalid definition checklist

  • No empty groups.
  • No empty alternatives.
  • No empty macro names.
  • No unmatched brackets or braces.
  • No repetition operator without a preceding node.
  • No binding metadata that points to a parameter or phrase not present in the grammar.

Authoring checklist

  • Use uppercase only for real literal keywords.
  • Quote values that contain spaces or significant punctuation.
  • Prefer readable multi-word clause phrases such as WITH AGE or DRY RUN.
  • Order alternatives intentionally.
  • Use macros only for dynamic vocabularies.
  • Write negative tests for incomplete input, wrong delimiters, unclosed strings, and bad macro values.

Canonical examples

PING ;
CREATE USER username [ PASSWORD password ] ;
PROCESS { FILE file_path | DIRECTORY dir_path } ;
GRANT ACCESS TO target_user ... ;
EXECUTE ${available_tasks} ON target_name ;
SET DATE day . month . year ;

Page map

Current product links