diff --git a/collects/algol60/examples/euler.a60 b/collects/algol60/examples/euler.a60 index 1b819a3af9..54cdbbd341 100644 --- a/collects/algol60/examples/euler.a60 +++ b/collects/algol60/examples/euler.a60 @@ -1,3 +1,5 @@ +#lang algol60 + begin procedure euler (fct,sum,eps,tim); value eps,tim; integer tim; diff --git a/collects/algol60/examples/jensen.a60 b/collects/algol60/examples/jensen.a60 index 9e56b72abe..e884279015 100644 --- a/collects/algol60/examples/jensen.a60 +++ b/collects/algol60/examples/jensen.a60 @@ -1,3 +1,5 @@ +#lang algol60 + begin integer procedure SIGMA(x, i, n); value n; diff --git a/collects/algol60/examples/nqueen.a60 b/collects/algol60/examples/nqueen.a60 index 493bc589e2..f74ec2ec2c 100644 --- a/collects/algol60/examples/nqueen.a60 +++ b/collects/algol60/examples/nqueen.a60 @@ -1,3 +1,5 @@ +#lang algol60 + begin comment -- From the NASE A60 distribution -- @@ -57,7 +59,7 @@ tryNextN: integer x; begin integer y; - + for y := 1 step 1 until N do begin if empcol [ y ] & empup [ x-y ] @@ -120,5 +122,3 @@ contN: end end - - diff --git a/collects/algol60/examples/primes.a60 b/collects/algol60/examples/primes.a60 index 80af372177..c4844f6459 100644 --- a/collects/algol60/examples/primes.a60 +++ b/collects/algol60/examples/primes.a60 @@ -1,3 +1,5 @@ +#lang algol60 + begin comment -- From the NASE A60 distribution -- @@ -57,11 +59,11 @@ begin for i := 2 step 1 until NN div 2 do for j := 2 * i step i until NN do arr [j] := false; - + for i := 2 step 1 until NN do if arr [i] then printnln (i); printsln (`done.') end -end +end diff --git a/collects/algol60/lang/algol60.rkt b/collects/algol60/lang/algol60.rkt new file mode 100644 index 0000000000..9b71e33fa7 --- /dev/null +++ b/collects/algol60/lang/algol60.rkt @@ -0,0 +1,8 @@ +#lang racket/base + +(require "../runtime.rkt" + "../prims.rkt") + +(provide (all-from-out racket/base) + (all-from-out "../prims.rkt") + (all-from-out "../runtime.rkt")) diff --git a/collects/algol60/lang/reader.rkt b/collects/algol60/lang/reader.rkt new file mode 100644 index 0000000000..017861bb4f --- /dev/null +++ b/collects/algol60/lang/reader.rkt @@ -0,0 +1,48 @@ +#lang s-exp syntax/module-reader +algol60/lang/algol60 + +#:read algol60-read +#:read-syntax algol60-read-syntax +#:info algol60-get-info +#:whole-body-readers? #t + + +(require "../parse.rkt" + ;; Parses to generate an AST. Identifiers in the AST + ;; are represented as syntax objects with source location. + + "../simplify.rkt" + ;; Desugars the AST, transforming `for' to `if'+`goto', + ;; and flattening `if' statements so they are always + ;; of the for `if then goto