Reranker Framework (ReFr)
Reranking framework for structure prediction and discriminative language modeling
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
interpreter-test.C
Go to the documentation of this file.
1 
5 #include <iostream>
6 #include <memory>
7 
8 #include "interpreter.H"
9 
10 using namespace std;
11 using namespace reranker;
12 
13 int
14 main(int argc, char **argv) {
15  cout << "Here is a list of abstract types and the concrete implementations\n"
16  << "you can construct:" << endl;
17  int debug = 1;
18  Interpreter interpreter(debug);
19 
20  cout << endl;
21  interpreter.PrintFactories(cout);
22 
23  cout << "\nHello! Please type assignment statements.\n" << endl;
24 
25  if (argc >= 2) {
26  interpreter.Eval(argv[1]);
27  } else {
28  interpreter.Eval(cin);
29  }
30 
31  cout << "\nNow doing some hard-coded testing, looking to see if you\n"
32  << "set a variable named \"f\" to have a boolean value." << endl;
33 
34  bool value_for_f;
35  bool success = interpreter.Get("f", &value_for_f);
36  if (success) {
37  cout << "Success! f=" << (value_for_f ? "true" : "false") << endl;
38  } else {
39  cout << ":( ... no boolean value for variable f" << endl;
40  }
41 
42  cout << "\n\nEnvironment: " << endl;
43  interpreter.PrintEnv(cout);
44 
45  cout << "\nHave a nice day!\n" << endl;
46 }
void Eval(const string &filename)
Evaluates the statements in the specified text file.
Definition: interpreter.H:180
void PrintFactories(ostream &os) const
Definition: interpreter.H:203
int main(int argc, char **argv)
Provides an interpreter for assigning primitives and Factory-constructible objects to named variables...
Provides an interpreter for assigning primitives and Factory-constructible objects to named variables...
Definition: interpreter.H:165
void PrintEnv(ostream &os) const
Definition: interpreter.H:199
bool Get(const string &varname, T *value) const
Retrieves the value of the specified variable.
Definition: interpreter.H:217