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 #379 from bjh21/bjh21-unterminated-string-fixes
[jackhill/mal.git]
/
yorick
/
step0_repl.i
1
func
READ
(
str
)
2
{
3
return str
4
}
5
6
func EVAL
(
exp
,
env
)
7
{
8
return exp
9
}
10
11
func PRINT
(
exp
)
12
{
13
return exp
14
}
15
16
func REP
(
str
)
17
{
18
return PRINT
(
EVAL
(
READ
(
str
),
""
))
19
}
20
21
func main
(
void
)
22
{
23
stdin_file
=
open
(
"/dev/stdin"
,
"r"
)
24
while
(
1
) {
25
write
,
format
=
"%s"
,
"user> "
26
line
=
rdline
(
stdin_file
,
prompt
=
""
)
27
if
(!
line
)
break
28
if
(
strlen
(
line
) >
0
)
write
,
format
=
"%s\n"
,
REP
(
line
)
29
}
30
write
,
""
31
}
32
33
main
;