hash-map equality: bash, c, coffee, cs, es6, ...
[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) {
10b07148
JM
28 if (args.Length > 0 && args[0] == "--raw") {
29 Mal.readline.mode = Mal.readline.Mode.Raw;
30 }
afde2df0 31
10b07148 32 // repl loop
afde2df0
JM
33 while (true) {
34 string line;
35 try {
10b07148 36 line = Mal.readline.Readline("user> ");
afde2df0 37 if (line == null) { break; }
10b07148 38 if (line == "") { continue; }
afde2df0
JM
39 } catch (IOException e) {
40 Console.WriteLine("IOException: " + e.Message);
41 break;
42 }
43 Console.WriteLine(PRINT(RE(null, line)));
44 }
45 }
46 }
47}