A68S(1)

NAME
a68s, indent68 - ALGOL 68S compiler

SYNOPSIS
a68s arguments

ack(etc) arguments

indent68 filename

DESCRIPTION
ALGOL68S source files should have the extension `.8'.

a68s accepts the same flags and conventions as ack (q.v.). Thus 'a68s -o prog prog.8' will compile the source in file prog.8, producing executable binary in prog and a program listing in prog.8.lst.

    WARNING. Although the ack system will have produced the usual intermediate files with suffices .k, .m and .o (and you may even stop the compilation at these intermediate stages if you wish), do not try to include other files (whether ending in .8 or in .anything else) as the present compiler has no facilities for separate or mixed-language compilation. Hopefully, this will be rectified some day.

    If the source file starts with a digit, it will be assumed that every line starts with a line number (but the sequencing is not checked). These line numbers will then appear on the .lst file, and will be used in diagnostic messages.

`indent68' will read the given filename which is expected to be an ALGOL 68 program. A correctly indented form of the same program is sent to the standard output. Note that, unlike more elaborate prettyprinters, it confines itself to inserting or removing blanks at the beginnings of lines (although it does insist upon a space after each go-on-symbol (;) and after a starting brief-comment-symbol (#). It is particularly intended for indenting programs that place their go-on-symbols at the start of the line (i.e. before the next statement rather than after the last one), but it will produce an acceptable indentation of any program.

LANGUAGE
The language implemented is the official sublanguage of ALGOL 68 (usually known as ALGOL 68S), as defined in [1] (see also Appendix 4 of [2]). The only features of ALGOL 68S not implemented are binary transput and stand back channel. On the other hand, in addition to the official features of ALGOL 68S, the heap-generator (but not the sample-heap-generator) is implemented. WARNING. The garbage collector is of the "access count" variety, and it will therefore not collect circular lists which may become inaccessible (however, circular lists constructed from local-generators are collected correctly on range exit).

The hardware representation is the official one ([3]), except for the absence of reserved-word stropping.

The principal limitations with respect to full ALGOL 68 are therefore as follows.

1.  All defining occurences must precede their applied occurrences (except for labels).

2.  No UNIONs or conformity-clauses or EMPTY.

3.  No FLEX (but STRING is OK) and no vacuums.

4.  Structures may not contain arrays, and 'row-of-row-of' modes are not permitted (as opposed to 'row-row-of' modes which are OK).

5.  No parallel-clauses or void-collateral-clauses (but displays are OK).

6.  No formatted transput.

7.  GOTO (or GO TO) may not be omitted in a jump.

8.  No procedured jumps.

9.  Existing operators (notably the standard-prelude ones) may not be redefined (nor may their priorities be altered).

10. Restricted standard-prelude. The following is a complete list of the standard indicators available.

    maxint, maxreal, smallreal, pi, maxabschar
    sqrt, exp, ln, nextrandom, random
    cos, arccos, sin, arcsin, tan, arctan
    bitspack, bytespack
    standin channel, standout channel, standin, standout
    open, establish, associate, close
    put, print, write, get, read
    space, newline, newpage, set, reset
    on logical file end, on physical file end, on page end
    on line end, maketerm
    chan, char number, line number, page number
    whole, fixed, float
    stop
    REPR, BIN, ENTIER, ROUND, ODD, SIGN, ABS, LWB, UPB
    RE, IM, ARG, CONJ
    NOT, AND, OR, OVER, MOD, SHL, SHR, I
    + , - , * , / , % , %* , ^ , ** , +*
    EQ, NE, GE, GT, LE, LT
    = , /= , >= , > , <= , <
    PLUSAB, MINUSAB, TIMESAB, DIVAB, OVERAB, MODAB, PLUSTO
    +:= , -:= , *:= , /:= , %:= , %*:= , +=:

PRAGMATS
The following pragmats are provided:
PR UPPER PR
    (enable upper-case stropping)
PR POINT PR
    (disable upper-case stropping)
    Note that point stropping always works (with either case of word). The essential difference with upper-case stropping is that upper-case words are assumed to be stropped whether a point is present or not. Thus it is always possible to write .PR UPPER .PR, which will be recognised whatever the previous stropping regime.
PR LIST PR
    (turn listing on)
PR NOLIST PR
    (turn listing off)
    listings are sent to the .lst file.
PR PAGE PR
    (start a new page on the .lst file)
PR WARN PR
    (include compile-time warning messages)
PR NOWARN PR
    (omit compile-time warning messages)

The words within a pragmat may be in either upper or lower case, and one pragmat may contain several such words, separated by commas, as in the following example which shows the default states.

    PR UPPER, LIST, WARN PR

DIAGNOSTICS
The compile-time error messages are self-explanatory. They can be divided into 3 categories:
    Lexcical errors (the offending lexeme is simply ignored)
    Syntactic errors (text up to the next ';' or ')', etc. is ignored)
    Semantic errors.
After the first syntactic error, further checking for semantic errors is inhibited.

On the .lst file, a row of "=" indicates parts of the text that have been ignored. A "1" under a particular symbol indicates the point where an error was detected (a "2" indicates that 2 errors were found there). An "S" ("C", "P") is printed in the margin wherever a new line of source text starts within a string-denotation (comment, pragmat). Thus mismatched delimiters for these things will readily stand out.

A run-time error message is followed by a print out of the stack, giving the line number in each active procedure. For each procedure, the active ranges are printed, starting from the innermost and finishing with the outermost. Within each range, the values ascribed to all identifiers and operators (apart from some manifest values) are listed in the order in which they were declared in the range. Names are printed as a "#" followed by a number. Not much significance should be attached to these numbers except to note that the same name will always be printed as the same number. At the end of each range, the value of any active loop counter (.FOR) together with its increment and target (.BY and .TO) will be printed.

ENVIRONMENT ENQUIRIES
The following figures apply primarily to machines with a wordsize of 32 bits. Figures for 16-bit machines are given in parentheses where appropriate.

    max int = 2147483647 (32767)
    max real = 1.701411733192600E+38 (on the VAX)
    small real = 3.469446951953614E-18 (on the VAX)
    bits width = 32 (16)
    bytes width = 4 (2)
    max abs char = 127
    null character = NULL (REPR(0))
    int lengths, int shorths, real lengths, real shorths,
    bits lengths, bits shorths,
    bytes lengths, bytes shorths
        all = 1
    int width = 10 (5)
    real width = 16
    exp width = 3
    error character = *
    flip = T
    flop = F
    On stand in channel:
        get possible, reset possible
    On stand out channel:
        put possible, reset possible, compressible,
        estab possible
    On associated files:
        get possible, put possiblle, set possible,
        reset possible

FILES
~em/bin/a68s
~em/bin/indent68
~em/lib/em_a68s?? - the compiler
~em/lib/em_a68s_init?? - compiler initialization
~em/mach/lib/MACH/tail_a68s - runtime library
~em/lang/a68s/a68s.1 - this manual

BUGS
There is no REAL arithmetic on the SUNs.
Excessive static nesting (especially with ELIFs or CASEs with many alternatives) can exceed certain stack spaces in the compiler.
Dimensions of arrays are limited to 8.

SEE ALSO
ack(I)

REFERENCES
[1] P. G. Hibbard, A Sublanguage of ALGOL 68, SIGPLAN Notices Vol. 12, No. 5, May 1977.
[2] C. H. Lindsey and S. G. van der Meulen, Informal Introduction to ALGOL 68, North Holland.
[3] Wilfred J. Hansen and Hendrik Boom, The Report on the Standard Hardware Representation for ALGOL 68, SIGPLAN Notices Vol. 12, No. 5, May 1977.