Installing & Running ALGOL Today

6.1 Algol 68 Genie (a68g)

Linux (Debian/Ubuntu): macOS (Homebrew): From source (any Unix-like system, including WSL or Cygwin on Windows):

Windows: the author's site provides a prebuilt Windows executable; alternatively install inside WSL and use the Linux instructions. Some features (parallel clauses, plotting, unit compilation) depend on the platform and optional libraries present at build time.

Source files conventionally use the extension .a68.

sudo apt install algol68g
a68g --version
brew install algol68g
# download algol68g-<version>.tar.gz from the author's site (jmvdveer.home.xs4all.nl)
tar xzf algol68g-<version>.tar.gz
cd algol68g-<version>
./configure
make
sudo make install
a68g hello.a68             # interpret (compile to an internal tree, then execute)
a68g --check hello.a68     # syntax/mode check only
a68g --trace hello.a68     # trace execution
a68g --help                # all options

6.2 MARST (ALGOL 60)

MARST is a GNU package distributed as source:

On Windows, build it inside WSL or MSYS2/Cygwin.

Translate, compile, run: MARST also ships macvt, a converter that helps translate programs written in other (older) hardware representations into MARST's representation.

Stropping used by MARST: keywords enclosed in apostrophes ('begin', 'real', 'procedure'), strings in double quotes, % for ÷ (see the table in §4.4). Spaces are insignificant outside strings.

# download marst-<version>.tar.gz from ftp.gnu.org/gnu/marst/
tar xzf marst-<version>.tar.gz
cd marst-<version>
./configure
make
sudo make install          # installs marst, macvt, libalgol and the manual
marst hello.alg -o hello.c         # ALGOL 60 -> C
gcc hello.c -lalgol -lm -o hello   # compile and link with the ALGOL runtime library
./hello

6.3 Other ALGOL 60 systems

NASE A60 (a60): an interpreter; run a60 program.a60. It provides its own built-in output procedures in addition to some standard ones; check a60 -h and its manual page for the stropping it expects and the available procedures.

jff-algol: a translator to C; follow its README to build. It implements ALGOL 60 with its own conventions for keywords and I/O.

All ALGOL 60 listings in this course are written for MARST. To use another implementation, change the stropping and I/O calls — the rest of the program is standard ALGOL 60.

6.4 Editor support

Syntax highlighting exists for Vim/Emacs (an a68-mode for Emacs), and generic highlighting can be configured in VS Code.

Use a monospaced font and indent with spaces; ALGOL programs often use 3- or 4-space indentation.

Keep one statement per line in early programs: free-format languages make it easy to hide mistakes.

6.5 Hello, world in both languages

ALGOL 60 (MARST) — hello.alg:

ALGOL 68 (a68g, UPPER stropping) — hello.a68:

Note the double parentheses in print((...)): print takes a single parameter, a *row* of printable values, written as a row display (... , ...).

'begin'
    outstring(1, "Hello, world!\n")
'end'
BEGIN
   print(("Hello, world!", newline))
END