ⓘ ABC (programming language)


ⓘ ABC (programming language)

ABC is an imperative general-purpose programming language and programming environment developed at CWI, Netherlands by Leo Geurts, Lambert Meertens, and Steven Pemberton. It is interactive, structured, high-level, and intended to be used instead of BASIC, Pascal, or AWK. It is not meant to be a systems-programming language but is intended for teaching or prototyping.

The language had a major influence on the design of the Python programming language; Guido van Rossum, who developed Python, previously worked for several years on the ABC system in the mid 1980s.


1. Features

Its designers claim that ABC programs are typically around a quarter the size of the equivalent Pascal or C programs, and more readable. Key features include:

  • Infinite precision arithmetic, unlimited-sized lists and strings, and other features supporting orthogonality and ease of use by novices.
  • Does not require variable declarations.
  • Explicit support for top-down programming.
  • Statement nesting is indicated by indentation, via the off-side rule.
  • Only five basic data types.

ABC was originally a monolithic implementation, leading to an inability to adapt to new requirements, such as creating a graphical user interface. ABC could not directly access the underlying file system and operating system.

The full ABC system includes a programming environment with syntax-directed editing, suggestions, persistent variables, and multiple workspaces - and is available as an interpreter/compiler, currently at version 1.05.02, and ported to Unix, DOS, Atari, and Apple Macintosh.


2. Example

An example function to collect the set of all words in a document:

HOW TO RETURN words document: PUT {} IN collection FOR line IN document: FOR word IN split line: IF word not.in collection: INSERT word IN collection RETURN collection