-
Notifications
You must be signed in to change notification settings - Fork 1
/
LAG-Util.h
executable file
·62 lines (52 loc) · 1.13 KB
/
LAG-Util.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef LAG_UTIL_H
#define LAG_UTIL_H
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <map>
using namespace std;
struct Type {
string name;
char level;
int n_dim;
int d1;
int d2;
Type() {
this->name = "";
this->level = 'L';
this->n_dim = 0;
this->d1 = 0;
this->d2 = 0;
}
Type( string name ) {
this->name = name;
this->level = 'L';
this->n_dim = 0;
this->d1 = 0;
this->d2 = 0;
}
};
struct Attribute {
string v; // Value
Type t; // type
string c; // code
map<string,string> label;
Attribute() {} // initialized with empty string
Attribute( string v, string t = "", string c = "" )
{
this->v = v;
this->t.name = t;
this->c = c;
}
};
typedef map<string,Type> symbol_table;
typedef map<string,int> var_temp_table;
bool is_number(const std::string& s);
string toStr( int n );
int toInt( string n );
string new_label( string cmd, map<string,int> &label_counter );
void init_operation_results(map<string,Type> &operation_results);
void init_c_operands_table(map<string,string> &c_op);
void init_type_names(map<string,Type> &type_names);
#endif /* LAG_UTIL_H */