-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvForth.cpp
More file actions
50 lines (36 loc) · 759 Bytes
/
vForth.cpp
File metadata and controls
50 lines (36 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// CalcInterp.cpp : Defines the entry point for the console application.
//
#include <iostream>
#include <fstream>
#include "Forth.hpp"
int main(int argc, char** argv)
{
if (argc > 1) {
ifstream source(argv[1]);
string inp;
vector<string> lines;
while (!source.eof()) {
std::getline(source, inp);
lines.push_back(inp);
}
Forth finterp(false);
for (auto line : lines) {
finterp.interp(line);
}
}
else {
Forth f(true);
if (true) {
cout << "vForth-cpp by Dominic Pace\n";
cout << "Compiled on " << __DATE__ << " at " << __TIME__ << "\n";
while (true) {
cout << ">";
string inp;
std::getline(std::cin, inp);
f.interp(inp);
cout << endl << "ok" << endl;
}
}
}
return 0;
}