Tree Notation Spec

A more formal spec of Tree Notation

Tree Notation Spec

Introduction to Two Dimensional Languages

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 moving in order.

Two dimensional languages break those assumptions. There may be multiple read heads that can move not just on the x axis but on the y axis as well.

Tree Notation is a middle ground that utilitizes ideas from the two dimensional language world using present day technology.

Tree Notation Spec

The Data Structure

The basic structure of a Tree Notation object is as follows:

interface TreeNode { parent: &TreeNode words: string[] children: TreeNode[] }

No Syntax Errors

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.

Isomorphism to Spreadsheets

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.

Special Symbols

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 edgeSymbol 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.

Tree Languages

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 here.

The Grammar Language is an advanced Tree Language for building other Tree Languages. This spec is written in a Tree Language called Scrolldown.

Gmail icon Twitter icon GitHub icon
Built with Scroll