source: icGREP/icgrep-devel/icgrep/cc_compiler.h @ 3935

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

Updates for icgrep-0.9: re simplifications, re names, replimit mods, debugged while loops

File size: 1.7 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 CC_COMPILER_H
8#define CC_COMPILER_H
9
10#include "ps_pablos.h"
11#include "cc_codegenobject.h"
12#include "utf_encoding.h"
13#include "cc_compiler_helper.h"
14
15#include <math.h>
16#include <utility>
17#include <iostream>
18#include <sstream>
19#include <string>
20#include <list>
21#include <map>
22#include <algorithm>
23
24#include <cassert>
25#include <stdlib.h>
26
27#define INT2STRING(i) static_cast<std::ostringstream*>(&(std::ostringstream() << i))->str()
28
29class CC_Compiler
30{
31public:
32    CC_Compiler(UTF_Encoding encoding);
33    std::list<PabloS*> compile(std::string basis_pattern,
34                               std::string gensym_pattern,
35                               const std::map<std::string, RE*>& re_map,
36                               std::list<CC*> predefined);
37private:
38    void process_re_map(CC_CodeGenObject& cgo, const std::map<std::string, RE*>& re_map);
39    void process_re(CC_CodeGenObject& cgo, RE* re);
40    void process_predefined(CC_CodeGenObject& cgo, std::list<CC*> predefined);
41    std::string bit_var(int n);
42    PabloE* make_bitv(int n);
43    PabloE* bit_pattern_expr(int pattern, int selected_bits);
44    PabloE* char_test_expr(int ch);
45    PabloE* make_range(int n1, int n2);
46    PabloE* GE_Range(int N, int n);
47    PabloE* LE_Range(int N, int n);
48    PabloE* char_or_range_expr(CharSetItem charset_item);
49    PabloE* charset_expr(CC* cc);
50    Expression* expr2pabloe(CC_CodeGenObject& cgo, PabloE* expr);
51    CC_CodeGenObject cc2pablos(CC_CodeGenObject cgo, CC* cc);
52
53    UTF_Encoding mEncoding;
54};
55
56#endif // CC_COMPILER_H
57
58
Note: See TracBrowser for help on using the repository browser.