├── tests ├── export.rkt ├── syncheck-test.rkt └── test.rkt ├── .gitignore ├── lang ├── algol60.rkt └── reader.rkt ├── cfg-parser.rkt ├── base.rkt ├── examples ├── jensen.a60 ├── euler.a60 ├── primes.a60 └── nqueen.a60 ├── LICENSE ├── README.md ├── info.rkt ├── algol60.rkt ├── prims.rkt ├── algol60.scrbl ├── runtime.rkt ├── tool.rkt ├── simplify.rkt ├── parse.rkt └── compile.rkt /tests/export.rkt: -------------------------------------------------------------------------------- 1 | #lang algol60 2 | begin 3 | procedure f(x); begin f := 1 / x; end; 4 | end 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Racket compiled files 2 | compiled/ 3 | 4 | # common backups, autosaves, lock files, OS meta-files 5 | *~ 6 | \#* 7 | .#* 8 | .DS_Store 9 | *.bak 10 | TAGS 11 | -------------------------------------------------------------------------------- /lang/algol60.rkt: -------------------------------------------------------------------------------- 1 | #lang racket/base 2 | 3 | (require "../runtime.rkt" 4 | "../prims.rkt") 5 | 6 | (provide (all-from-out racket/base) 7 | (all-from-out "../prims.rkt") 8 | (all-from-out "../runtime.rkt")) 9 | -------------------------------------------------------------------------------- /cfg-parser.rkt: -------------------------------------------------------------------------------- 1 | #lang racket/base 2 | 3 | ;; Legacy module. cfg-parser used to live in the algol60 collection. 4 | ;; This module re-exports its contents for backwards compatibility. 5 | 6 | (require parser-tools/cfg-parser) 7 | (provide (all-from-out parser-tools/cfg-parser)) 8 | -------------------------------------------------------------------------------- /base.rkt: -------------------------------------------------------------------------------- 1 | #lang racket 2 | (require "prims.rkt" 3 | "runtime.rkt") 4 | 5 | (define base-importing-stx #'here) 6 | 7 | (provide (all-from-out racket) 8 | (all-from-out "prims.rkt") 9 | (all-from-out "runtime.rkt") 10 | base-importing-stx) 11 | -------------------------------------------------------------------------------- /examples/jensen.a60: -------------------------------------------------------------------------------- 1 | #lang algol60 2 | 3 | begin 4 | integer procedure SIGMA(x, i, n); 5 | value n; 6 | integer x, i, n; 7 | begin 8 | integer sum; 9 | sum:=0; 10 | for i:=1 step 1 until n do 11 | sum:=sum+x; 12 | SIGMA:=sum; 13 | end; 14 | integer q; 15 | printnln(SIGMA(q*2-1, q, 7)); 16 | end 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This component of Racket is distributed under the under the Apache 2.0 2 | and MIT licenses. The user can choose the license under which they 3 | will be using the software. There may be other licenses within the 4 | distribution with which the user must also comply. 5 | 6 | See the files 7 | https://github.com/racket/racket/blob/master/racket/src/LICENSE-APACHE.txt 8 | and 9 | https://github.com/racket/racket/blob/master/racket/src/LICENSE-MIT.txt 10 | for the full text of the licenses. 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # algol60 2 | 3 | This the source for the Racket package: "algol60". 4 | 5 | ### Contributing 6 | 7 | Contribute to Racket by submitting a [pull request], reporting an 8 | [issue], joining the [development mailing list], or visiting the 9 | IRC or Slack channels. 10 | 11 | ### License 12 | 13 | Racket, including these packages, is free software, see [LICENSE] 14 | for more details. 15 | 16 | By making a contribution, you are agreeing that your contribution 17 | is licensed under the [Apache 2.0] license and the [MIT] license. 18 | 19 | [MIT]: https://github.com/racket/racket/blob/master/racket/src/LICENSE-MIT.txt 20 | [Apache 2.0]: https://www.apache.org/licenses/LICENSE-2.0.txt 21 | [pull request]: https://github.com/racket/algol60/pulls 22 | [issue]: https://github.com/racket/algol60/issues 23 | [development mailing list]: https://lists.racket-lang.org 24 | [LICENSE]: LICENSE 25 | -------------------------------------------------------------------------------- /info.rkt: -------------------------------------------------------------------------------- 1 | #lang info 2 | 3 | (define collection "algol60") 4 | (define build-deps '("at-exp-lib" 5 | "rackunit-lib" 6 | "racket-doc" 7 | "scribble-doc" 8 | "scribble-lib" 9 | "drracket-tool-lib" 10 | "drracket-plugin-lib")) 11 | 12 | (define drracket-name "Algol 60") 13 | (define drracket-tools '(("tool.rkt"))) 14 | (define drracket-tool-names '("Algol 60")) 15 | 16 | (define scribblings '(("algol60.scrbl" () (experimental 40)))) 17 | (define deps '("base" 18 | "compatibility-lib" 19 | "drracket-plugin-lib" 20 | "errortrace-lib" 21 | "gui-lib" 22 | "parser-tools-lib" 23 | "string-constants-lib")) 24 | 25 | (define pkg-desc "An implementation of the Algol60 language") 26 | 27 | (define pkg-authors '(mflatt robby)) 28 | 29 | (define license 30 | '(Apache-2.0 OR MIT)) 31 | -------------------------------------------------------------------------------- /examples/euler.a60: -------------------------------------------------------------------------------- 1 | #lang algol60 2 | 3 | begin 4 | 5 | procedure euler (fct,sum,eps,tim); value eps,tim; integer tim; 6 | real procedure fct; real sum,eps; 7 | comment euler computes the sum of fct(i) for i from zero up to 8 | infinity by means of a suitably refined euler transformation. The 9 | summation is stopped as soon as tim times in succession the absolute 10 | value of the terms of the transformed series are found to be less than 11 | eps. Hence, one should provide a function fct with one integer argument, 12 | an upper bound eps, and an integer tim. The output is the sum sum. euler 13 | is particularly efficient in the case of a slowly convergent or 14 | divergent alternating series; 15 | begin integer i,k,n,t; array m[0:15]; real mn,mp,ds; 16 | i:=n:=t:=0; m[0]:=fct(0); sum:=m[0]/2; 17 | nextterm: i:=i+1; mn:=fct(i); 18 | for k:=0 step 1 until n do 19 | begin mp:=(mn+m[k])/2; m[k]:=mn; 20 | mn:=mp end; 21 | if (abs(mn) then goto