Particles 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.
Particles is a middle ground that utilitizes ideas from the two dimensional language world using present day technology.
The basic structure of a Particles object is as follows:
interface Particle {
parent: &Particle
atoms: string[]
subparticles: Particle[]
}
All documents are valid Particles documents. Like binary notation, there are no syntax errors in Particles. For every possible string abc:
new Particle(abc).toString() === abc
Errors can only occur at a higher semantic level in Parsers.
A program in Particles is isomorphic to a spreadsheet. A single row is a particle. Atoms are in cells. You can make a row a subparticle of the row above it by indenting it with an additional blank cell in the head.
A Particles object is a sequence of bits/bytes/characters(hereafter abbreviated as chars). Particles 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:
particleBreakSymbol delimits particles (lines), atomBreakSymbol delimits atoms (cells/atoms), and edgeSymbol is used to indicate the parent/child relationship between particles.
With just particleBreakSymbol and atomBreakSymbol, you get Grid Notation. The addition of edgeSymbol adds the parent/child concept.
By convention those special symbols are:
particleBreakSymbol
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)
atomBreakSymbol
space character
Keyboard: Space Key
Binary: 00100000
Hex: 20
Decimal: 32
As string: " "
edgeSymbol
# by convention is the same as atomBreakSymbol above
For better interoperability with existing spreadsheet applications the tab character \t
can be used for atomBreakSymbol and edgeSymbol.
Although in theory edgeSymbol and atomBreakSymbol can conflict, in practice, given higher level Parsers, that does not happen.
This is currently the full spec of Particles.
The structure above defines Particles. Particles is a very basic notation. On top of Particles, people use Parsers. You can see examples of higher level Parsers in the Parsers Designer.
Parsers is an advanced language for building other languages. This spec is written in a language built on Parsers called Scroll.