Add dist targets to most implementations.
[jackhill/mal.git] / tcl / step1_read_print.tcl
CommitLineData
54d9903c
DM
1source mal_readline.tcl
2source types.tcl
3source reader.tcl
4source printer.tcl
5
6proc READ str {
7 read_str $str
8}
9
10proc EVAL {ast env} {
11 return $ast
12}
13
14proc PRINT exp {
15 pr_str $exp 1
16}
17
18proc REP str {
19 PRINT [EVAL [READ $str] {}]
20}
21
22fconfigure stdout -translation binary
23
24# repl loop
25while {true} {
26 set res [_readline "user> "]
27 if {[lindex $res 0] == "EOF"} {
28 break
29 }
30 set line [lindex $res 1]
31 if {$line == ""} {
32 continue
33 }
34 if { [catch { puts [REP $line] } exception] } {
35 puts "Error: $exception"
36 }
37}
38puts ""