Tree Notation is a subset of a class of languages called two dimensional languages.
One dimensional languages assume a one dimensional array of bits with a single read head
Two dimensional languages break those assumptions. There may be multiple read heads that
Tree Notation is a middle ground that utilitizes ideas from the two dimensional language
The basic structure of a Tree Notation object is as follows:
interface TreeNode {
parent: &TreeNode
words: string[]
children: TreeNode[]
}
All documents are valid Tree Notation documents. Like binary notation, there are no syntax errors in Tree Notation. For every possible string abc:
new TreeNotation(abc).toString() === abc
Errors can only occur at a higher semantic level in Tree Languages.
A program in Tree Notation is isomorphic to a spreadsheet. A single row is a node. Words are in cells. You can make a row a child of the row above it by indenting it with an additional blank cell in the head.
A Tree Notation object is a sequence of bits/bytes/characters(hereafter abbreviated as chars). Tree Notation requires the definition of 3 special chars, which turn an otherwise unstructured linear sequence of chars into a structured recursive tree object.
Those 3 special chars are:
nodeBreakSymbol delimits nodes (lines), wordBreakSymbol delimits words (cells), and edgeSymbol is used to indicate the parent/child relationship between nodes.
With just nodeBreakSymbol and wordBreakSymbol, you get Grid Notation. The addition of edgeSymbol adds the parent/child concept.
By convention those special symbols are:
nodeBreakSymbol
newline character
Keyboard: Enter Key
Binary: 00001010
Hex: 0A
Decimal: 10
As string: "\n"
(Note: On Windows, "\r" is treated the same as any other non-special char)
wordBreakSymbol
space character
Keyboard: Space Key
Binary: 00100000
Hex: 20
Decimal: 32
As string: " "
edgeSymbol
# by convention is the same as wordBreakSymbol above
For better interoperability with existing spreadsheet applications the tab character \t
is often used for wordBreakSymbol and edgeSymbol.
Although in theory edgeSymbol and wordBreakSymbol can conflict, in practice, given a higher level Tree Language grammar, that does not happen.
This is currently the full spec of Tree Notation.
The structure above defines Tree Notation. Tree Notation is a very basic notation. On top of Tree Notation, people build Tree Languages. You can see examples of higher level Tree Languages in the Tree Language Designer.
The Grammar Language is an advanced Tree Language for building other Tree Languages. This spec is written in a Tree Language called Scroll.