mirror of
https://github.com/kanaka/mal.git
synced 2024-09-20 10:07:45 +03:00
a708140106
All tests pass, but readline support (via Linenoise module) is commented out in step0_repl.pl as it is not a core module. Should maybe change it when docker support is added.
31 lines
412 B
Raku
31 lines
412 B
Raku
use v6;
|
|
use lib IO::Path.new($?FILE).dirname;
|
|
use reader;
|
|
use printer;
|
|
use types;
|
|
|
|
sub read ($str) {
|
|
return read_str($str);
|
|
}
|
|
|
|
sub eval ($ast) {
|
|
return $ast;
|
|
}
|
|
|
|
sub print ($exp) {
|
|
return pr_str($exp, True);
|
|
}
|
|
|
|
sub rep ($str) {
|
|
return print(eval(read($str)));
|
|
}
|
|
|
|
sub MAIN {
|
|
while (my $line = prompt 'user> ').defined {
|
|
say rep($line);
|
|
CATCH {
|
|
when X::MalException { .Str.say }
|
|
}
|
|
}
|
|
}
|