Merge pull request #386 from asarhaddon/test-let-recursive-def
[jackhill/mal.git] / ada.2 / step0_repl.adb
1 with Ada.Text_IO;
2
3 with Readline;
4
5 procedure Step0_Repl is
6
7 function Read return String with Inline;
8
9 function Eval (Ast : in String) return String;
10
11 procedure Print (Ast : in String) with Inline;
12
13 procedure Rep with Inline;
14
15 ----------------------------------------------------------------------
16
17 function Eval (Ast : in String) return String
18 is (Ast);
19
20 procedure Print (Ast : in String) is
21 begin
22 Ada.Text_IO.Put_Line (Ast);
23 end Print;
24
25 function Read return String is (Readline.Input ("user> "));
26
27 procedure Rep is
28 begin
29 Print (Eval (Read));
30 end Rep;
31
32 ----------------------------------------------------------------------
33
34 begin
35 loop
36 begin
37 Rep;
38 exception
39 when Readline.End_Of_File =>
40 exit;
41 end;
42 -- Other exceptions are really unexpected.
43 end loop;
44 Ada.Text_IO.New_Line;
45 end Step0_Repl;