ZetCode

Algol 68 stropping

last modified November 13, 2026

Algol 68 programs are printed in ordinary text, but the language still needs to tell a keyword from an identifier. It does this with a presentation convention called stropping, which decides where a bold tag may begin. This article explains the default convention, the alternative that Genie supports, and the rules for identifiers and operator tags that follow from them.

Res stropping

The default convention is res stropping: bold tags, which include keywords and mode names, are written in upper case, and identifiers are written in lower case. The interpreter compares the two cases exactly, so the program below is valid while the same program in lower case is not.

res.a68
BEGIN
  INT small = 5;
  print((whole(small, 0), newline))
END

BEGIN, INT, and END are bold tags, and small is an identifier. Writing begin or int instead removes the keyword, and the program is rejected at the first such word. The layout, by contrast, is free: indentation and line breaks do not matter.

$ a68g res.a68
5

Keywords and identifiers

Case separates the two kinds of tag, not a list of reserved words. A lower-case word is an identifier even when the same word in upper case is a keyword, so begin and end can name variables.

keywords.a68
BEGIN
  INT begin = 1, end = 2;
  print((whole(begin + end, 0), newline))
END

The declaration is accepted and the sum is 3. The names are ordinary identifiers and have nothing to do with the BEGIN and END that enclose them. Mixing the cases inside one word does not work either: Begin is read as the bold tag B followed by the identifier egin, which is why such a name produces an error about an undeclared tag.

$ a68g keywords.a68
3

Spaces and digits in identifiers

An identifier is a sequence of lower-case letters, digits, and underscores. Spaces inside it are ignored, so my count and mycount are two spellings of the same tag, and the program may use either spelling after the declaration.

spaces.a68
BEGIN
  INT my count = 5;
  print((whole(mycount, 0), newline))
END

The declaration writes the name with a space and the use writes it without one, yet both refer to the same variable. Digits are allowed as well, so item2 and sum3 are valid names. Underscores are also accepted in identifiers, although they are not allowed inside a number: 1_000 is not an integer denotation.

$ a68g spaces.a68
5

Numbers and operator tags

The same token rules apply to operator tags. An operator tag consists of letters, so a name such as TIMES2 is not one tag: it is read as the operator TIMES followed by the number 2. This is why operators declared with OP are usually given purely alphabetic names.

digits.a68
BEGIN
  INT item2 = 5;
  INT sum3 = item2 + 10;
  print((whole(sum3, 0), newline))
END

Identifiers, on the other hand, may end in digits, so item2 and sum3 are single tags. The difference is easy to remember: an operator is a symbol made of letters, while an identifier is a name and may contain digits and underscores.

$ a68g digits.a68
15

Quote stropping

Quote stropping writes bold tags in upper case inside single quotes. Genie selects it with the --quote-stropping option, and the program below cannot be run without that option, because the quoted words would not be recognised as keywords.

quote.a68
'BEGIN'
  'INT' total = 5;
  'INT' count = 3;
  print((whole(total + count, 0), newline))
'END'

Only bold tags are quoted. Identifiers such as total and the predeclared names print, whole, and newline are written plainly, and quoting them, as in 'newline', is an error. The quoted tags are still upper case; quote stropping changes the marking of a bold tag, not its spelling.

$ a68g --quote-stropping quote.a68
8

Case in strings and comments

Stropping applies to tags only. Text inside strings and comments is passed through unchanged, so a comment or a message may use any case and any words, including the ones that are keywords elsewhere.

textcase.a68
# BEGIN and END are plain text inside a comment #
BEGIN
  STRING label = "Begin and End";
  print((label, newline))
END

The comment is skipped and the string keeps its capital letters. This is useful for messages and for documentation, which do not have to follow the upper-case convention of keywords.

$ a68g textcase.a68
Begin and End

Other stropping modes

The Revised Report describes four conventions: res, quote, point, and bold stropping. Algol 68 Genie 2.8.4 supports the first two, with res stropping as the default and quote stropping behind the option shown above. The option name is also accepted as --quotestropping.

Point stropping, which marks bold tags with a leading point, and bold stropping, which relies on the font rather than on characters, are not available in this build: asking for them produces an unrecognised option error. The --strict option disables most language extensions but leaves the stropping rules alone, so a quote-stropped program still needs --quote-stropping when --strict is used.

Next steps

The literals article shows which denotations depend on case, such as the lower-case digits of a based denotation. The operators article explains the tags that OP declares, and Algol 68 basics uses the default convention throughout.

Source

Revised Report on the Algorithmic Language Algol 68

The Algol 68 Genie project

In this article we have read a program under res stropping, used lower-case keywords as identifiers, written identifiers with spaces and digits, and run the same kind of program under quote stropping. The literals article continues with the values that these tags denote.

Author

My name is Jan Bodnar, and I am a passionate programmer with extensive programming experience. I have been writing programming articles since 2007. To date, I have authored over 1,400 articles and 8 e-books. I possess more than ten years of experience in teaching programming.

List all Algol 68 tutorials.