|Developer(s)||Marcel van der Veer|
|Initial release||September 2002|
|Stable release||2.8 / October 2013|
|Operating system||Linux, FreeBSD, Mac OS X, Microsoft Windows|
|License||GNU General Public License|
ALGOL68G or Algol 68 Genie is an ALGOL 68 compiler-interpreter developed from 2002 onwards. ALGOL68G is a nearly full implementation of ALGOL 68 as defined by the Revised Report and also implements partial parametrisation, which is an extension of ALGOL 68. After successful parsing of an entire source program, the syntax tree, that serves as an intermediate program representation, is interpreted. The interpreter performs many runtime checks. Optionally, units with large interpreter overhead can be compiled to speed execution.
Features of Algol 68 Genie
In keeping with the letter and spirit of Algol68, the interpreter performs checks on many events, for example: assigning to
NIL or dereferencing of
NIL, using uninitialised values, invalid operands to standard prelude operators and procedures, bounds check when manipulating arrays, overflow of arithmetic modes, "dangling references", that are names that refer to deallocated storage. It implements
LONG INT, LONG REAL and
LONG COMPLEX with roughly doubled precision with respect to
INT, REAL, COMPLEX and implementation of multiprecision arithmetic through
LONG LONG INT, LONG LONG REAL and
LONG LONG COMPLEX which are modes with user defined precision which is set by an option. It supports Format texts, straightening and formatted transput. Transput routines work generically on files, (dynamic) strings and pipes. There is support for the parallel clause on platforms that support POSIX threads. Upper stropping is the default, quote stropping is optional.
Algol68G interfaces with a range of other local facilities. For example on systems that support them, Linux extensions that allow e.g. for executing child processes that communicate through pipes, matching regular expressions or fetching web page contents, procedures for drawing using the GNU Plotting Utilities, various numerical procedures and basic linear algebra procedures from the GNU Scientific Library, and various PostgreSQL client routines.
Extensions to Algol 68
- Implementation of C.H. Lindsey's partial parametrisation proposal, which allows for currying in Algol 68, giving it a functional sublanguage.
- A simple refinement preprocessor to facilitate top-down program construction.
- Implementation of pseudo-operators
- Implementation of a post-checked loop. A do-part may enclose a serial clause followed by an optional until-part, or just enclose an until-part. This is an alternative to the paradigm Algol 68 post-check loop
WHILE ... DO SKIP OD.
- Implementation of
DOWNTOwith comparable function as
TOin loop clauses;
TOincreases, the loop counter by the value of the (implicit) by-part.
Deviations from the Revised Report language
The important deviations are:
- The important difference with the Revised Report transput model is that Algol 68 Genie transput does not operate on
FLEX [ ] FLEX [ ] FLEX [ ] CHAR, but on a
FLEX [ ] CHAR. This maps better onto operating systems such as Unix or Linux.
- Values are not initialised to
SKIP. Instead, uninitialised values provoke a runtime error. This is believed to be a safe choice since many programming errors result from using uninitialised values.
- The Algol 68 Genie parallel clause deviates from the Algol 68 parallel clause when parallel clauses are nested. In Algol 68 Genie, stack frames inside a parallel unit are private, therefore if parallel units modify a shared variable then this variable must be declared outside the outermost parallel clause, and a jump out of a parallel unit can only be targeted at a label outside the outermost parallel clause.
- Transputting a file is essentially sequential. Only
resetcan intervene with sequential processing.
- When all arguments in a call of
readf, printf, writef, getfor
putfare processed, the format associated with the corresponding file is purged - that is, remaining insertions are processed and the format is discarded.