HCoop
/
jackhill
/
mal.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
Merge pull request #219 from hinrik/perl6_eval_tests
[jackhill/mal.git]
/
perl6
/
step1_read_print.pl
1
use
v6
;
2
use
lib IO
::
Path
.
new
($
?FILE
).
dirname
;
3
use
reader
;
4
use
printer
;
5
use
types
;
6
7
sub
read
(
$str
) {
8
return
read_str
(
$str
);
9
}
10
11
sub
eval
(
$ast
) {
12
return
$ast
;
13
}
14
15
sub
print
(
$exp
) {
16
return
pr_str
(
$exp
,
True
);
17
}
18
19
sub
rep
(
$str
) {
20
return
print
(
eval
(
read
(
$str
)));
21
}
22
23
sub
MAIN
{
24
while
(
my
$line
=
prompt
'user> '
).
defined
{
25
say
rep
(
$line
);
26
CATCH
{
27
when
X
::
MalException
{ .
Str
.
say
}
28
}
29
}
30
}