Skip to content

Specification0 · How to read this specification

0.3

How to read a written form

A written form is the mould of a construct: it says which words are fixed, which slots you fill in and which parts you may leave out.

Markdown version

0.3.1 How it works

Every language construct is first shown with its form. Coloured words are written exactly as shown. Slots «like this» are replaced by code. Whatever goes between ⟦ and ⟧ is optional: you may write it or not.

While «condition» Do
  «statements»
EndWhile
Figure 0.3-1.A form has fixed words and slots. Filling the slots gives a line of code; whatever goes between ⟦ and ⟧ you may leave out.

At the top, the If form: the word If and the word Then are fixed, and between them there is a dashed slot called condition. An arrow goes down from the slot to the filled line If n > 0 Then. At the bottom, Else appears between double brackets: it is an optional part that can be left out.

When a form has parts that repeat or are optional, it comes with an anatomy: a real line of code split into pieces, with the name of each one underneath.

  1. Whileword that opens the loop
  2. n <= 3condition: checked before every round
  3. Doword that ends the line

This program fills the While form with a condition and a statement:

ProgramFilling in the form

Algorithm Cuenta
  Define n As Integer <- 1;
  While n <= 3 Do
    Write n;
    n <- n + 1;
  EndWhile
EndAlgorithm

Output

1
2
3

The program finishes normally.

In short

  • Coloured words: written as they are.
  • Slots «like this»: you fill them in.
  • ⟦…⟧: optional part.
  • An anatomy splits a real example and names each piece.