Technology

This page focuses on simplicity—one of the key attributes of TOO that makes it viable for citizens.

Always remember, however, that there’s usually a simpler and better way to do something than the first way that pops into your head.

Simplified syntax

Compact languages like Python, C, and Go typically consist of around 90 syntax rules, 30 operators, and 30 keywords. In contrast, TOO is simplified to the bare minimum, aiming to be the world’s simplest practical general-purpose language (GPL), with just 12 syntax rules, 5 operators, and no keywords. This minimalism accelerates both learning and development. The table below provides a comparison.

LanguageKeywordsOperatorsSyntax rulesYear
Fortran39161701957
C3227901970
C++90352001979
Python3339901991
Java51342501995
Ruby1328601995
C#78412202000
Go25341002009
Typescript50351502012
Rust35452502015
TOO05122022

TOO syntax rules

A carefully designed language with just 12 syntax rules can be remarkably powerful.

thing ::= Id     { (declare|event|when|func)* “}

event ::= Id params

when ::= (Id  [[ declare ]”])+ Id params block

func ::= Id paramsparams [block]

act ::= [“*”]  expr [“?block [block]]

block ::= { act*  }

arg ::= expr|“*

expr ::= sub+

sub ::= (Id|Const|call) [[arg]] [“” (declare|params)]

call ::= Id (” [(arg ,)* arg]   )

params ::= “(” [(declare ,”)* (declare [])] )

declare ::= [“[]”] [Id:”] (Id .”)* Id [“=Const] [Const]

TOO 5 operators

It is assumed that citizens are familiar with spreadsheets and this reassures the use of functions (e.g., AND(x,y), IF(x,y,z)) together with fluent style chaining that is natural for citizens, refraining completely from infix binary operators that might be difficult to remember (e.g., “<<=”), solving precedence of operations and simplifying readability.

The redirect operator implements a right-hand side assignment, which is uncommon in programming (most languages use left-hand side assignment). While this form of assignment might seem unusual to experienced programmers, it can be more intuitive for citizen developers without prior knowledge of programming. This is because the right-hand side assignment aligns more naturally with the structure of spoken language, where the subject is often introduced at the end of a sentence. This design choice could therefore feel more familiar and accessible for non-programmers.

Redirect

[ ]     Subscript

? Decision point

* Wildcard and iteration

=   Initial value for thing in declaration

The following is the full specification of the TOO language.

Simplified flow-control

Expert systems especially, and rule-based systems in general, present a simplified approach to flow control that is human-friendly and easy to master. In such systems, the logic is structured in rules with a trigger and a list of sequential actions.

While most GPLs advocate loops that considerably increase citizen incomprehension, TOO provides many ways to create an iterative logic but it is loop-free. The algorithms in TOO may only contain downstream branching. This means that rule actions (or function actions) are executed in a sequential order and there is no way to go back and re-execute an action that was already executed. This is illustrated in the flowchart below.

TOO flowcharts feature only downstream branching. Action details are shown on hover.

Simplified editing

Editing a TOO program requires only a mouse:

(a) The data structure is created by point and click – moving instances from the INVENTORY to the MEMBERS section.

(b) The flowchart skeleton is created by dragging and dropping a box over an edge, and there are only two types of boxes to choose from: rectangle and diamond.

(c) Editing a flowchart box only requires selection from a dropdown menu with fairly limited alternatives and only at specific points where the expression can grow or shrink. In the example below, there are two edit points marked by the blue “+” symbols.

Editing a flowchart box is limited to specific points.

Powerful expressions

In most use-cases, users will write simple expressions that utilize a reference object followed by a call. For example, switch turn·it·on. Nevertheless, the syntax supports the creation of much more complex expressions. The examples provided illustrate some of the unique features of the TOO language, highlighting its expressive power despite being a micro language. Let’s break down each example to understand the concepts they demonstrate.

Example 1: Redirect Operator ()

radius squared times math π area times height cylinder

 

Explanation:

  • The first part of the expression calculates the area of a circle (radius^2 * π) and stores the result in a temporary number thing called “area”.
  • The second part then multiplies this area by the height to compute the volume of a cylinder and stores this result in another temporary variable called “cylinder”.

 

The redirect operator () is used to assign the byproduct(s) of a sub-expression to a temporary variable(s). These temporary variables can be used later in the code, allowing for clear and concise expressions. This unique type of assignment on the right-hand side combined with the fluent-style chaining makes expressions more readable, close to a spoken language: “radius squared times pi goes to area, times height goes to cylinder”.

Example 2: Spawning lightweight threads

go run(fixtures, schedule[*], *)

 

Explanation:

  • This expression goes over all the elements of the schedule array and spawns a new thread for every element, saving the need for a “while” or “for” statement.
  • The star operator appears twice in this expression; (1) in the first time inside the subscript, the value of the element is taken (for example, “off/until 20:00,on/4h”), (2) in the second time where it appears alone, the key of the element is taken (for example, “WallWashLights”).

 

The star operator (*) acts as a wildcard, effectively creating a loop that iterates over the array elements. The “go run” function spawns a lightweight thread for each element in the array, with each thread handling one schedule. See also the homepage demo video where this expression is illustrated.

Example 3: Loop within a loop

* fixtures control(schedule split(“,”)[*], name)

 

Explanation:

  • The first star operator at the beginning of the action means iterator: run the action in an infinite loop. This is the way to implement a cyclic schedule that rolls back to the beginning when the last step ends.
  • The the second star operator means wildcard. Since the byproduct of the “split” function is an array, the star operator means go over all the elements of the array. For example, element “0” will be “off/until 20:00” and element “1” will be “on/4h”.

 

Effectively, in this single action we have a loop within a loop.

What's NOT in TOO

  • No flow-control statements (such as for, while, foreach, etc.).
  • No basic types (such as int, char, int64, etc.).
  • No variable declarations (such as var, let, etc.).
  • No binary operators, e.g., a + b. TOO uses fluent style chaining instead, e.g., a plus (b).
  • No global objects that could be referenced anywhere.
  • No pointers.

What's in TOO

  • Fully object oriented – Every thing is just a thing, built from its member things. Things can be anything: gmail, string, sensor, boolean, number, twitter, sms, spreadsheet… anything…
  • Rule-based – the logic is structured in rules; each has a trigger and actions. This concept greatly simplifies the logic for novice developers (and also for professionals) since it is loop-free.
  • Functional language – functions in TOO may return multiple values, may take a variable number of arguments (variadic functions), and may be anonymous (lambda functions).
  • Maps replacing arrays – this means that elements are referenced by named subscripts rather than sequential numbers 0,1,… The extra information in the indices enriches the application. For example, the call to voice caller talk(phone[*], “hi “,*, “, hello world!”) would generate a voice call with the following message to all phone elements. For example, “hi Bob, hello world!”, and “hi Alice, hello world!”; where Bob, Alice, … are the indices of phone array.
  • Automatic memory allocation – maps also render unnecessary the New operator since the elements of a map could be allocated automatically when referenced (they are later deleted by garbage collection).
  • Concurrency based on light-weight threads and channels – adopted from Go language.
  • Interfaces and inheritance – adopted from Go language.

Simplicity is the ultimate sophistication. It takes a lot of hard work to make something simple, to truly understand the underlying challenges and come up with elegant solutions. [...] It's not just minimalism or the absence of clutter. It involves digging through the depth of complexity. To be truly simple, you have to go really deep. [...] You have to deeply understand the essence of a product in order to be able to get rid of the parts that are not essential.


.

terms of service                             privacy policy