hobbes
a language, embedded compiler, and runtime for efficient dynamic expression evaluation, data storage and analysis
parser.H
Go to the documentation of this file.
1 
2 #ifndef HOBBES_READ_EXPR_HPP_INCLUDED
3 #define HOBBES_READ_EXPR_HPP_INCLUDED
4 
5 #include <hobbes/lang/module.H>
6 #include <hobbes/lang/expr.H>
8 #include <stdexcept>
9 #include <string>
10 
11 namespace hobbes {
12 
13 // for pattern-matching, we need to be able to have the whole compiler
14 class cc;
15 
16 // read various forms of expressions, definitions
17 ModulePtr defReadModuleFile(cc*, const std::string&);
18 ModulePtr defReadModule(cc*, const char*);
19 ModulePtr defReadModule(cc*, const std::string&);
20 
21 typedef std::pair<std::string, ExprPtr> ExprDefn;
22 ExprDefn defReadExprDefn(cc*, const std::string&);
23 
24 ExprPtr defReadExpr(cc*, const std::string&);
25 
26 // allow users to override AST construction for variable names in expressions and patterns
27 // (this can be used for alternate resolution of variable names as global values)
28 Expr* defVarCtor(const std::string&, const LexicalAnnotation&);
29 Pattern* defPatVarCtor(const std::string&, const LexicalAnnotation&);
30 
31 typedef Expr* (*VarCtorFn)(const std::string&, const LexicalAnnotation&);
33 
34 typedef Pattern* (*PatVarCtorFn)(const std::string&, const LexicalAnnotation&);
36 
37 }
38 
39 #endif
Definition: pattern.H:48
Expr *(* VarCtorFn)(const std::string &, const LexicalAnnotation &)
Definition: parser.H:31
Expr * defVarCtor(const std::string &, const LexicalAnnotation &)
Definition: parser.C:178
Pattern * defPatVarCtor(const std::string &, const LexicalAnnotation &)
Definition: parser.C:182
ExprPtr defReadExpr(cc *, const std::string &)
Definition: parser.C:168
Definition: boot.H:7
ExprDefn defReadExprDefn(cc *, const std::string &)
Definition: parser.C:158
ModulePtr defReadModule(cc *, const char *)
Definition: parser.C:145
Pattern *(* PatVarCtorFn)(const std::string &, const LexicalAnnotation &)
Definition: parser.H:34
std::shared_ptr< Expr > ExprPtr
Definition: expr.H:58
Definition: cc.H:64
std::shared_ptr< Module > ModulePtr
Definition: module.H:171
Definition: lannotation.H:22
ModulePtr defReadModuleFile(cc *, const std::string &)
Definition: parser.C:134
void overridePatVarCtor(PatVarCtorFn)
Definition: parser.C:184
std::pair< std::string, ExprPtr > ExprDefn
Definition: parser.H:21
Definition: expr.H:15
void overrideVarCtor(VarCtorFn)
Definition: parser.C:180