mirror of
https://github.com/kanaka/mal.git
synced 2024-09-21 02:27:10 +03:00
8a19f60386
- Reorder README to have implementation list after "learning tool" bullet. - This also moves tests/ and libs/ into impls. It would be preferrable to have these directories at the top level. However, this causes difficulties with the wasm implementations which need pre-open directories and have trouble with paths starting with "../../". So in lieu of that, symlink those directories to the top-level. - Move the run_argv_test.sh script into the tests directory for general hygiene.
46 lines
909 B
Ada
46 lines
909 B
Ada
with Ada.Text_IO;
|
|
|
|
with Readline;
|
|
|
|
procedure Step0_Repl is
|
|
|
|
function Read return String with Inline;
|
|
|
|
function Eval (Ast : in String) return String;
|
|
|
|
procedure Print (Ast : in String) with Inline;
|
|
|
|
procedure Rep with Inline;
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
function Eval (Ast : in String) return String
|
|
is (Ast);
|
|
|
|
procedure Print (Ast : in String) is
|
|
begin
|
|
Ada.Text_IO.Put_Line (Ast);
|
|
end Print;
|
|
|
|
function Read return String is (Readline.Input ("user> "));
|
|
|
|
procedure Rep is
|
|
begin
|
|
Print (Eval (Read));
|
|
end Rep;
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
begin
|
|
loop
|
|
begin
|
|
Rep;
|
|
exception
|
|
when Readline.End_Of_File =>
|
|
exit;
|
|
end;
|
|
-- Other exceptions are really unexpected.
|
|
end loop;
|
|
Ada.Text_IO.New_Line;
|
|
end Step0_Repl;
|