Commit | Line | Data |
---|---|---|
9ddaa0b9 ST |
1 | #include "String.h" |
2 | #include "ReadLine.h" | |
3 | ||
4 | #include <iostream> | |
5 | #include <memory> | |
6 | ||
7 | String READ(const String& input); | |
8 | String EVAL(const String& ast); | |
9 | String PRINT(const String& ast); | |
10 | String rep(const String& input); | |
11 | ||
12 | static ReadLine s_readLine("~/.mal-history"); | |
13 | ||
14 | int main(int argc, char* argv[]) | |
15 | { | |
16 | String prompt = "user> "; | |
17 | String input; | |
18 | while (s_readLine.get(prompt, input)) { | |
19 | std::cout << rep(input) << "\n"; | |
20 | } | |
21 | return 0; | |
22 | } | |
23 | ||
24 | String rep(const String& input) | |
25 | { | |
26 | return PRINT(EVAL(READ(input))); | |
27 | } | |
28 | ||
29 | String READ(const String& input) | |
30 | { | |
31 | return input; | |
32 | } | |
33 | ||
34 | String EVAL(const String& ast) | |
35 | { | |
36 | return ast; | |
37 | } | |
38 | ||
39 | String PRINT(const String& ast) | |
40 | { | |
41 | return ast; | |
42 | } |