hobbes
a language, embedded compiler, and runtime for efficient dynamic expression evaluation, data storage and analysis
evaluator.H
Go to the documentation of this file.
1 
2 #ifndef HI_EVALUATOR_HPP_INCLUDED
3 #define HI_EVALUATOR_HPP_INCLUDED
4 
5 #include <hobbes/hobbes.H>
6 #include "www.H"
7 
8 namespace hi {
9 
10 typedef std::vector<std::string> ModuleFiles;
11 
12 struct Args {
13  typedef std::map<std::string, std::string> NameVals;
14 
15  ModuleFiles mfiles;
16  std::string evalExpr;
17  bool showDbg;
19  bool silent;
20  int replPort;
21  int httpdPort;
23  NameVals scriptNameVals;
24  bool machineREPL; // should we structure console I/O for machine-reading?
25 
26  Args() : useDefColors(false), silent(false), replPort(-1), httpdPort(-1), exitAfterEval(false), machineREPL(false) {
27  }
28 };
29 
30 class evaluator {
31 public:
32  evaluator(const Args&);
33  ~evaluator();
34 
35  void runMachineREPL();
36 
37  // support the 'evaluator' interface on a local compiler context
38  void showClass(const std::string& cname);
39  void showInstances(const std::string& cname);
40 
41  void loadModule(const std::string& mfile);
42 
43  void evalExpr(const std::string& expr);
44  void printUnsweetenedExpr(const std::string& expr);
45  void printTypeOf(const std::string& expr, bool);
46 
47  void printTypeEnv();
48  hobbes::str::seq completionsFor(const std::string& prefix) const;
49  void printLLVMModule();
50  void printAssembly(const std::string& expr, void (*)(void*,size_t));
51 
52  void perfTestExpr(const std::string& expr);
53  void breakdownEvalExpr(const std::string& expr);
54  void resetREPLCycle();
55 private:
57  bool silent;
59 };
60 
61 }
62 
63 #endif
64 
bool showDbg
Definition: evaluator.H:17
bool machineREPL
Definition: evaluator.H:24
std::vector< std::string > ModuleFiles
Definition: evaluator.H:10
Definition: evaluator.H:30
std::map< std::string, std::string > NameVals
Definition: evaluator.H:13
int httpdPort
Definition: evaluator.H:21
ModuleFiles mfiles
Definition: evaluator.H:15
bool silent
Definition: evaluator.H:57
Definition: evaluator.H:12
Definition: cio.H:7
std::string evalExpr
Definition: evaluator.H:16
bool silent
Definition: evaluator.H:19
Args()
Definition: evaluator.H:26
void runMachineREPL(cc *)
Definition: prepl.C:309
Definition: www.H:11
hobbes::cc ctx
Definition: evaluator.H:56
WWWServer * wwwd
Definition: evaluator.H:58
Definition: cc.H:64
std::vector< std::string > seq
Definition: str.H:19
bool useDefColors
Definition: evaluator.H:18
bool exitAfterEval
Definition: evaluator.H:22
NameVals scriptNameVals
Definition: evaluator.H:23
int replPort
Definition: evaluator.H:20