Previous

9. Tokens and symbols

9.1. Tokens

{Tokens {9.1.1.f } are symbols {9.1.1.h} possibly preceded by pragments {9.2.1.a }. Therefore, pragments may appear between symbols wherever the syntax produces a succession of tokens. However, in a few places, the syntax specifically produces symbols rather than tokens, notably within denotations {8}, format-texts {10.3.4.1.1.a } and, of course, within pragments. Therefore, pragments may not occur in these places.}

9.1.1. Syntax

a) CHOICE STYLE start{34a } : where (CHOICE) is (choice using boolean), STYLE if{94f ,-} token ; where (CHOICE) is (CASE), STYLE case{94f ,-} token.

b) CHOICE STYLE in{34e } : where (CHOICE) is (choice using boolean), STYLE then{94f ,-} token ; where (CHOICE) is (CASE), STYLE in{94f ,-} token.

c) CHOICE STYLE again{34l } : where (CHOICE) is (choice using boolean), STYLE else if{94f ,-} token ; where (CHOICE) is (CASE), STYLE ouse{94f ,-} token.

d) CHOICE STYLE out{34l } : where (CHOICE) is (choice using boolean), STYLE else{94f ,-} token ; where (CHOICE) is (CASE), STYLE out{94f ,-} token.

e) CHOICE STYLE finish{34a } : where (CHOICE) is (choice using boolean), STYLE fi{94f ,-} token ; where (CHOICE) is (CASE), STYLE esac{94f ,-} token.

f) NOTION token : pragment{92a } sequence option, NOTION symbol{94a,b,c,d,e,f,g,h } .

g) *token : NOTION token{f}.

h) *symbol : NOTION symbol{94a,b,c,d,e,f,g,h } .

9.2. Comments and pragmats

{A source of innocent merriment. Mikado, W.S.Gilbert.}
{A pragment is a comment or a pragmat. No semantics of pragments is given and therefore the meaning {2.1.4.1.a } of any program is quite unaffected by their presence. It is indeed the intention that comments should be entirely ignored by the implementation, their sole purpose being the enlightenment of the human interpreter of the program.

Pragmats may, on the other hand, convey to the implementation some piece of information affecting some aspect of the meaning of the program which is not defined by this Report, for example:

· the action to be taken upon overflow {2.1.4.3.h } or if the scope rule is violated (as in 5.2.1.2.b ), e.g., PR overflow check on PR, PR overflow check off PR, PR scope check on PR or PR scope check off PR;

· the action to be taken upon completion of the compilation process, e.g., PR compile only PR, PR dump PR or PR run PR;

· that the language to be implemented is some sublanguage or superlanguage of ALGOL 68, e.g., PR nonrec PR (for a routine-text which may be presumed to be non-recursive);

· that the compilation may check for the truth, or attempt to prove the correctness, of some assertion, e.g.:

INT a, b; read((a, b)) PR ASSERT a >= 0 & b > 0 PR;
INT q := 0, r := a;
WHILE r >= b PR ASSERT a = b * q + r & 0 < r PR
DO (q +:= 1, r -:= b) OD
  PR ASSERT a = b * q + r & 0 <= r & r < b PR
. They may also be used to convey to the implementation that the source text is to be augmented with some other text, or edited in some way, for example:

· some previously compiled portion of the particular-program is to be invoked, e.g., PR WITH segment FROM album PR;

· the source text is continued on some other document, e.g., PR READ FROM another file PR;

· the end of the source text has been reached, e.g., PR FINISH PR.

The interpretation of pragmats is not defined in this Report, but is left to the discretion of the implementer, who ought, at least, to provide some means whereby all further pragmats may be ignored, for example:

PR pragmats off PR
.
}
{PR algol 68 PR BEGIN PROC PR nonrec PR pr = VOID: pr; pr END PR run PR PR ? PR Revised Report on the Algorithmic Language ALGOL 68.}

9.2.1. Syntax

A) PRAGMENT :: pragmat ; comment.

a) pragment{80a ,91f,A341b,h,A348a,b,c,A349a,A34Ab} : PRAGMENT{b}.

b) PRAGMENT{a} : STYLE PRAGMENT symbol{94b ,-}, STYLE PRAGMENT item{c} sequence option, STYLE PRAGMENT symbol{94b ,-}.

{STYLE :: brief ; bold ; style TALLY.}

c) STYLE PRAGMENT item{b} : character glyph{814c } ; STYLE other PRAGMENT item{d}.

d) A production rule may be added for each notion designated by 'STYLE other PRAGMENT item' {c, for which no hyper-rule is given in this Report} each of whose alternatives is a symbol {1.1.3.1.f }, different from any terminal production of 'character glyph' {8.1.4.1.c }, and such that no terminal production of any 'STYLE other PRAGMENT item' is the corresponding 'STYLE PRAGMENT symbol'. {Thus COMMENT # COMMENT might be a comment, but ¢ ¢ ¢ could not.} {Examples:

}

a)
PR list PR ·# source program to be listed #
c)
l ·?

 
Next