source: icGREP/icgrep-devel/icgrep/re/re_compiler.h @ 4197

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

More refactoring of the RE system; moved the original re/RE_Compiler to compiler.cpp and the PBIX_Compiler to the re/RE_Compiler.

File size: 1.2 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 RE_TO_PABLO_COMPILER_H
8#define RE_TO_PABLO_COMPILER_H
9
10//Regular Expressions
11#include "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
21namespace re {
22class RE_Compiler {
23public:
24    RE_Compiler(std::map<std::string, std::string> name_map);
25    CodeGenState compile(RE *re);
26    CodeGenState compile_subexpressions(const std::map<std::string, RE*>& re_map);
27private:
28    void compile(RE * re, CodeGenState & cg_state);
29    void compile(Alt * alt, CodeGenState & cg_state);
30    void compile(Seq * seq, CodeGenState & cg_state);
31    void compile(Rep * rep, CodeGenState & cg_state);
32    void compileUnboundedRep(RE * repeated, int lb, CodeGenState  & cg_state);
33    void compileBoundedRep(RE * repeated, int lb, int ub, CodeGenState &cg_state);
34    void compile(Name * name, CodeGenState & cg_state);
35
36
37
38    static bool hasUnicode(const RE *re);
39
40    SymbolGenerator symgen;
41    std::map<std::string, std::string> m_name_map;
42};
43
44}
45
46#endif // COMPILER_H
Note: See TracBrowser for help on using the repository browser.