← All projects

Tools

T.O.A.L.

The Totally Original Applicable Language: a plain-English programming language, with a compiler to JavaScript, built by a team of four. Variables are “make a with 55”, loops are “loop over”, and functions are “automations”.

T.O.A.L. logo: a book with a computer monitor on the cover
Type
Team of 4
Category
Tools
Stack
JavaScript · Node.js · Ohm

How it fits together

Architecture diagram: T.O.A.L. source to Parser; Parser to Analyzer (parse tree); Analyzer to Optimizer (program graph); Optimizer to Generator; Generator to JavaScript

The compiler translates English-like source into JavaScript in four stages. The analyzer builds an object graph of the program and reports descriptive errors before any code is generated.

The problem

Programming syntax is a barrier for newcomers. T.O.A.L. is written like plain English so beginners can express logic without learning symbols first, while still covering the basics real programs need: variables, lists, conditionals, loops and reusable functions.

Approach

  • A compiler pipeline in Node.js: an Ohm grammar parses the source, an analyzer checks scopes and types and builds a program graph, and a generator emits JavaScript
  • Plain-English syntax for variables and arithmetic, such as make a with 55; add 1 to x; and 9 plus 10
  • Familiar keywords renamed: function becomes automation, return becomes output, else becomes ifnot, and for and while become loop over and loop while
  • Types renamed to approachable words: word, number, boolean and list
  • A built-in list structure with append and remove, plus conditionals, loops, custom automations and # comments
  • The full syntax is documented side by side with its JavaScript equivalent, so learners can see how each idea maps to traditional code

Example

make list with [1, 2, 3, 4, 5];
loop over element in list {
  add 1 to element;
  print element;
}

automate addNums(num1, num2) {
  output num1 plus num2;
}
A loop and a custom automation in T.O.A.L.

Highlights

  • Plain-English syntax for variables, math, lists, loops and conditionals
  • Custom automations (reusable functions)
  • Syntax reference with JavaScript comparison tables
  • Built by a team of four, with its own website