Hacked #lang algol60 into place
(Patch from Danny Yoo, touched up a little.)
This commit is contained in:
parent
9091fddc52
commit
5e16770932
|
@ -1,3 +1,5 @@
|
|||
#lang algol60
|
||||
|
||||
begin
|
||||
|
||||
procedure euler (fct,sum,eps,tim); value eps,tim; integer tim;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#lang algol60
|
||||
|
||||
begin
|
||||
integer procedure SIGMA(x, i, n);
|
||||
value n;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
8
collects/algol60/lang/algol60.rkt
Normal file
8
collects/algol60/lang/algol60.rkt
Normal file
|
@ -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"))
|
48
collects/algol60/lang/reader.rkt
Normal file
48
collects/algol60/lang/reader.rkt
Normal file
|
@ -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 <exp> then goto <label> else goto <label>'
|
||||
|
||||
"../compile.rkt"
|
||||
;; Compiles a simplified AST to Scheme.
|
||||
|
||||
mzlib/file
|
||||
syntax/strip-context)
|
||||
|
||||
|
||||
(define (algol60-read in)
|
||||
(map syntax->datum (algol60-read-syntax #f in)))
|
||||
|
||||
|
||||
(define (algol60-read-syntax src in)
|
||||
(define parsed (parse-a60-port in src))
|
||||
(define simplified (simplify parsed #'here))
|
||||
(define compiled (compile-simplified simplified #'here))
|
||||
(define stripped (strip-context compiled))
|
||||
|
||||
(list stripped))
|
||||
|
||||
|
||||
|
||||
;; Extension: cooperate with DrRacket and tell it to use the default,
|
||||
;; textual lexer and color scheme when editing algol programs.
|
||||
(define (algol60-get-info key default default-filter)
|
||||
(case key
|
||||
[(color-lexer)
|
||||
(dynamic-require 'syntax-color/default-lexer
|
||||
'default-lexer)]
|
||||
[else
|
||||
(default-filter key default)]))
|
Loading…
Reference in New Issue
Block a user