An interpreter for simple Algol 68 programs

L. Ammeraal · Centrum Wiskunde & Informatica (CWI), the national research institute for mathematics and computer science in the Netherlands · 1973

An interpretative implementation for a sublanguage of ALGOL 68 is informally described in this report.Since the implementation has been written in ALGOL 60 and there is no translation from ALGOL 68 source text to an object program, a high degree of machine independence has been achieved.The report includes both the text of the interpreter and some typical ALGOL 68 programs, along with the output produced by the interpreter.we want to make a definitive choice.An example of such a situation is the choice between the real denotation 12.3 and the integral denotation 12, if a denotation has to be recognized and the four symbols 12.3 are available in X[p] ••• X[p+3].In this example the second alternative must not be taken, because otherwise the two symbols .3 in X[p+l] and X[p+2] cannot be parsed afterwards.This knowledge cannot be derived from the rule for the notion "denotation", but other rules have.tobe considered as well.Similarly, in the general case above we will reject the choice of the shorter string a if the longer string a is also available as a candidate.By this strategy, a grammar with the rules N P,Q.P u,v; u Q v,w , cannot be used in this form to recognize the string uvw as a terminal production of N, so not all context free grammars are suited for our method.For the grammar rules N P,Q p u,v; u.Q w.uvw can be recbgnized, however.The procedure body for Pis P := i:t. AND (INP(u),INP(v)) t h e n ~~ INP(u)For reasons of efficiency, however, the rule for Pis preferably replaced by the rulesNow the same considerations as above apply to R, with a= v, n = 1, a=£ ( the null string) , m = O.The procedure body for R might be R := i:t.INP(v) then true else true • For a boolean value the mark "bool" will appear in column A and the integer 1 or O in column B for tr-ue or faZse, respectively.Likewise for a character, the mark "ahar" is put into column A, and an integer representation of a character into column B. A real number will be put into column E, in which case column Bis not used and the mark "real" is in column A.Now suppose that after the identity declaration int i = 5with the resulting picture above, the variable declaration int x:=i, int y follows.Then the given picture will be supplemented as follows.

Read the paper · More papers on PaperTik