source: icGREP/icgrep-devel/icgrep/pbix_compiler.h @ 4122

Last change on this file since 4122 was 4122, checked in by cameron, 5 years ago

UnboundedRep_helper

File size: 1.9 KB
Line 
1/*
2 *  Copyright (c) 2014 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 *  icgrep is a trademark of International Characters.
5 */
6
7#ifndef COMPILER_H
8#define COMPILER_H
9
10//Regular Expressions
11#include "re_re.h"
12#include "re_name.h"
13#include "re_start.h"
14#include "re_end.h"
15#include "re_seq.h"
16#include "re_alt.h"
17#include "re_rep.h"
18
19//Pablo Expressions
20#include "pe_pabloe.h"
21#include "pe_sel.h"
22#include "pe_advance.h"
23#include "pe_all.h"
24#include "pe_and.h"
25#include "pe_charclass.h"
26#include "pe_call.h"
27#include "pe_matchstar.h"
28#include "pe_scanthru.h"
29#include "pe_not.h"
30#include "pe_or.h"
31#include "pe_var.h"
32#include "pe_xor.h"
33
34//Pablo Statements
35#include "ps_pablos.h"
36#include "ps_assign.h"
37#include "ps_if.h"
38#include "ps_while.h"
39
40//Code Generation
41#include "symbol_generator.h"
42
43#include <iostream>
44#include <string>
45#include <sstream>
46#include <list>
47#include <vector>
48#include <map>
49
50
51struct CodeGenState{
52    std::list<PabloS*> stmtsl;
53    std::string newsym;
54};
55
56class Pbix_Compiler
57{
58public:
59    Pbix_Compiler(std::map<std::string, std::string> name_map);
60    CodeGenState compile(RE *re);
61    CodeGenState compile_subexpressions(const std::map<std::string, RE*>& re_map);
62private:
63    CodeGenState re2pablo_helper(RE *re, CodeGenState cg_state);
64    CodeGenState Seq_helper(std::list<RE*>* lst, std::list<RE*>::const_iterator it, CodeGenState cg_state);
65    CodeGenState Alt_helper(std::list<RE*>* lst, std::list<RE*>::const_iterator it, CodeGenState cg_state);
66    CodeGenState UnboundedRep_helper(RE* repeated, int lb, CodeGenState cg_state);
67    CodeGenState BoundedRep_helper(RE* repeated, int lb, int ub, CodeGenState cg_state);
68
69    bool unicode_re(RE* re);
70    bool unicode_re_helper(RE* re, bool found);
71
72    SymbolGenerator symgen;
73    std::map<std::string, std::string> m_name_map;
74};
75
76#endif // COMPILER_H
Note: See TracBrowser for help on using the repository browser.