Notation

Grammar

The grammar of Par is declared in Lexer and Syntax blocks. It uses the following notation:

  • Sequences of capital letters like DIGIT represent lexer tokens

  • Italic names in CamelCase like Item represent parser nonterminals

  • Character sequences in monospace like type represent literals

  • Characters may be represented using escape sequences, like \n

    • x? means x, zero or once
    • x* means x, zero or more
    • x+ means x, once or more
    • xa..b means at least a and at most b of x
  • x | y means either x or y

  • [ and ] group characters together, like [x X] or [a-z]

  • character sequences (and groups of them) can be negated by ~, like ~\n

  • ( and ) group arbitrary rules for precedence