2021-07-09
Today I’d like to illustrate the simplicity and the mathematical beauty of TAO.
If we leave certain parts abstract, TAO’s grammar can be defined in one line of ABNF, like so:
(open TAO close / 1*symbol) TAO = *
The abstract portions are in lowercase blue. The meaning of this line is:
A TAO
is ZERO OR MORE parts, each of which is EITHER an
open
followed by a TAO
followed by a
close
OR one or more symbol
s.
If we define open
to be [
,
close
to be ]
, and symbol
to
be:
"`" any / (any - "[" - "]" - "`")
Then the grammar will match the same strings as the canonical grammar.
It’s interesting to contrast this definition with an abstract definition of a Dyck language:
(open S close) S = *
As we can see the only difference is that TAO adds the
1*symbol
alternative before the closing paren in the
definition.
A Dyck language can express any kind of a tree structure. TAO can express any kind of a tree structure with interleaved data. Or better: interleafed, as the data is always carried in the leafs (leaves) of the tree structures.