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

Last change on this file since 4194 was 4194, checked in by nmedfort, 5 years ago

Modified RE module to use a LLVM-like dyn_cast system; added 'make' functions to hide RE constructors.

File size: 1.4 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_re.h"
12//Pablo Statements
13#include "ps_pablos.h"
14//Code Generation
15#include "symbol_generator.h"
16
17#include <string>
18#include <list>
19#include <map>
20
21
22struct CodeGenState{
23    std::list<PabloS*> stmtsl;
24    std::string newsym;
25};
26
27class Pbix_Compiler
28{
29    typedef re::RE                  RE;
30    typedef re::Vector              Vector;
31    typedef Vector::const_iterator  const_iterator;
32
33public:
34    Pbix_Compiler(std::map<std::string, std::string> name_map);
35    CodeGenState compile(RE *re);
36    CodeGenState compile_subexpressions(const std::map<std::string, RE*>& re_map);
37private:
38    CodeGenState re2pablo_helper(RE *re, CodeGenState cg_state);
39    CodeGenState Seq_helper(Vector * lst, const_iterator it, CodeGenState cg_state);
40    CodeGenState Alt_helper(Vector * lst, const_iterator it, CodeGenState cg_state);
41    CodeGenState UnboundedRep_helper(RE* repeated, int lb, CodeGenState cg_state);
42    CodeGenState BoundedRep_helper(RE* repeated, int lb, int ub, CodeGenState cg_state);
43
44    static bool hasUnicode(const RE *re);
45
46    SymbolGenerator symgen;
47    std::map<std::string, std::string> m_name_map;
48};
49
50#endif // COMPILER_H
Note: See TracBrowser for help on using the repository browser.