Notation

Grammar

The syntax is specified using a variant of Extended Backus-Naur Form (EBNF):

Production  = production_name '=' [ Expression ] '.' .
Expression  = Term { '|' Term } .
Term        = Factor { Factor } .
Factor      = production_name | token | Group | Option | Repetition .
Group       = '(' Expression ')' .
Option      = '[' Expression ']' .
Repetition  = '{' Expression '}' .

Productions are expressions constructed from terms and the following operators, in increasing precedence:

|   alternation
()  grouping
[]  option (0 or 1 times)
{}  repetition (0 to n times)

Lowercase production names identify lexical tokens (terminals, defined in Lexical elements). Capitalized names identify non-terminals (syntactic productions). Lexical tokens are enclosed in double quotes "".

The form a … b represents an arbitrary character or token from a through b as alternatives.

Reading examples

Script source is presented in fenced code blocks:

def greet { <c> do "say hello [name $c]" }

Most examples in this document are fragments meant to illustrate one construct, not complete scripts. A complete script is a sequence of top-level forms (Declarations and scope). When a fragment contains a bare statement (let foo …, do …, [recall $self …]), read it as if it appeared inside an enclosing block body, since the top level admits only def, const, and event handlers.

Examples are drawn from or modelled on real scripts in the world data.

Terminology