Project

General

Profile

Statistics
| Branch: | Revision:

cool / src / lib / GMLMIP-0.1 / parser / mlf-driver.h @ 7c4d2eb4

History | View | Annotate | Download (1.5 KB)

1
#ifndef MLF_DRIVER_HH
2
#define MLF_DRIVER_HH
3
#include <string>
4
#include "mlf-parser.tab.h"
5
#include "lex.yy.h"
6
#include "../formulas/formula.h"
7

    
8
using namespace std;
9

    
10

    
11
//Tell Flex the lexer's prototype:
12
# define YY_DECL                                        \
13
        yy::mlf_parser::token_type                         \
14
yylex (yy::mlf_parser::semantic_type* yylval,      \
15
                yy::mlf_parser::location_type* yylloc,      \
16
                mlf_driver& driver)
17
// ... and declare it for the parser's sake.
18
YY_DECL;
19

    
20

    
21
class mlf_driver{
22
        public:
23
                mlf_driver();
24
                ~mlf_driver();
25

    
26
                // The parsed formula object will be construced here
27
                IFormula* formula;
28
                
29
        private:                
30
                char logic;
31
                
32
        public:
33
                char get_logic(){ return logic; };
34

    
35
                void set_formula_bdd(bdd b);
36
                void set_formula_gml(){ logic='g'; formula = new GML_Formula; };
37
                void set_formula_pml(){ logic='p'; formula = new PML_Formula; };
38

    
39
                /* Calls formula->variable and formula->modal respectively
40
                 requires ints to be pre-loaded into upper and lower. In the
41
                 case of only one integer being required we load it into n.*/
42
                bdd variable(int n);
43
                bdd modal(bdd *b, int n, int m);
44

    
45
                // Extract the formula object
46
                void extract_formula(IFormula* &ptr);                
47

    
48
                // Handling the scanner.
49
                void scan_begin ();
50
                void scan_end ();
51
                bool trace_scanning;
52

    
53
                // Run the parser.  Return 0 on success.
54
                int parse (const std::string& f);
55
                std::string file;
56
                bool trace_parsing;
57

    
58
                // Error handling.
59
                void error (const yy::location& l, const std::string& m);
60
                void error (const std::string& m);
61
};
62
#endif