HCoop
/
jackhill
/
mal.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
All: show comments with stats target.
[jackhill/mal.git]
/
erlang
/
src
/
step0_repl.erl
1
%%%
2
%%% Step 0: REPL
3
%%%
4
5
-
module
(
step0_repl
).
6
7
-
export
([
main
/
1
]).
8
9
main
(
_
) ->
10
case
io
:
get_line
(
standard_io
,
"user> "
)
of
11
eof
->
12
% break out of the loop
13
io
:
format
(
"~n"
),
14
ok
;
15
{
error
,
Reason
} ->
16
io
:
format
(
"Error reading input: ~p~n"
, [
Reason
]),
17
exit
(
ioerr
);
18
Line
->
19
io
:
format
(
"
~s
~n"
, [
print
(
eval
(
read
(
string
:
strip
(
Line
,
both
,
$
\n
))))]),
20
main
(
""
)
21
end
.
22
23
read
(
String
) ->
24
String
.
25
26
eval
(
String
) ->
27
String
.
28
29
print
(
String
) ->
30
String
.