by Breck Yunits
I introduce the core idea of a new language for making languages.
Creating a great programming language is a multi-step process. One step in that process is to decide on syntax and formally define a language in a parser notation such as BNF. Unfortunately, like the programming languages they describe, these parser notations are complex, brittle and error-prone.
Below I introduce the core idea of a much simpler parser notation for defining 2D Languages.
A microlang in Parsers consists of a set of Parser Definitions including a catchall Parser Definition.
A Parser Definition consists of a match rule and optionally another Parsers microlang.
Everything is encoded in the same sytnax (Particles), hence Parsers is written in Parsers.
A Parsers file for an imagined microlang called Tally, with 2 Parsers {+, -}
might look like this:
TallyParser
catchAllParser errorParser
parsers
errorParser
expressionParser extends TallyParser
words int+
+Parser extends expressionParser
-Parser extends expressionParser
A valid program in the Tally microlang defined by the file above:
+ 4 5
- 1 1
The introduction above is minimal but shows the core idea: a new notation (Particles) can be used to define new languages in a language (Parsers) that itself is defined in Parsers on top of Particles.
We have developed and open-sourced Parsers a compiler-compiler implementing these ideas.
Future publications and/or open source releases will delve into the additional features found in the compiler-compiler.