The formal grammar of TAO is defined below in various notations.
All grammar definitions should be equivalent.
A reference implementation of the grammar is available as an interactive parser in JavaScript.
For brevity the following simple rules are defined only descriptively:
any
is any printable Unicode character, as defined is YAML 1.2. specification.any-except-meta
is any
excluding `
or [
or ]
linefeed
is the line feed character (hexadecimal code 0x0A)any-except-linefeed
is any
excluding the line feed characterop
is the symbol `
followed by any
symbol.note
is one or more symbols that are not `
or [
or ]
.tree
is a tao
inbetween a [
and a ]
.tao
is zero or more parts each of which is a tree
or an op
or a note
. op = "`" any
note = 1*any-except-meta
tree = "[" tao "]"
tao = *(tree / op / note)
<op> ::= "`" <any>
<note> ::= <any-except-meta> | <note> <note>
<tree> ::= "[" <tao> "]"
<tao> ::= "" | <tree> | <op> | <note> | <tao> <tao>