interpreter.scm - The actual interpreter.
ff.scm - The definitions for the finite functions; needed
for the environments in the interpreter.
parser.scm - The parser and lexical analyzer for the
interpreter.
interpreter.tar.gz - The entire interpreter.
A few test functions in the language may be this:
scm > (read-eval-print)
--> 5;
5
--> define x = 6;
--> x;
6
--> define f = proc(a) +(a, 5);
--> f(3);
8
--> let x = 5 in add1(x);
6
--> let y = 3 in begin
y := sub1(y);
y := +(x, y);
y
end;
8
--> define fact = proc(x) if zero(x) then 1 else *(x,
fact(-(x, 1)));
--> fact(5);
120
--> define even = proc(x) if zero(x) then 1 else odd(-(x,
1));
--> define odd = proc(x) if zero(x) then 0 else even(-(x,
1));
--> even(4);
1
--> even(5);
0
--> odd(7);
1
--> odd(6);
0
--> letarray a[3] in begin
a[0] := 4;
a[1] := 7;
a[2] := 3;
+(a[0], *(a[1], a[2]))
end;
25
--> define p = proc(a) a[0] := 3;
--> letarray b[2] in begin
b[0] := 7;
b[1] := 3;
p(b);
b[0]
end;
3
--> ^D
EXIT;
Home