Merge pull request #11 from treeform/patch-1
[jackhill/mal.git] / cs / step0_repl.cs
CommitLineData
afde2df0
JM
1using System;
2using System.IO;
53beaa0a 3using Mal;
afde2df0
JM
4
5namespace Mal {
6 class step0_repl {
7 // read
8 static string READ(string str) {
9 return str;
10 }
11
12 // eval
13 static string EVAL(string ast, string env) {
14 return ast;
15 }
16
17 // print
18 static string PRINT(string exp) {
19 return exp;
20 }
21
86b689f3 22 // repl
afde2df0
JM
23 static string RE(string env, string str) {
24 return EVAL(READ(str), env);
25 }
26
27 static void Main(string[] args) {
28 string prompt = "user> ";
afde2df0
JM
29
30 while (true) {
31 string line;
32 try {
53beaa0a 33 line = Mal.readline.Readline(prompt);
afde2df0
JM
34 if (line == null) { break; }
35 } catch (IOException e) {
36 Console.WriteLine("IOException: " + e.Message);
37 break;
38 }
39 Console.WriteLine(PRINT(RE(null, line)));
40 }
41 }
42 }
43}