-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexp.h
More file actions
57 lines (47 loc) · 937 Bytes
/
exp.h
File metadata and controls
57 lines (47 loc) · 937 Bytes
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
#pragma once
#ifndef EXP_H
#define EXP_H
#include <QMainWindow>
#include <vector>
using namespace std;
class Exp
{
public:
QString name;
int val;
vector<Exp*> child;
Exp(QString n = "", int v = 0): name(n), val(v) {};
virtual ~Exp();
};
class VarExp : public Exp
{
public:
VarExp(QString n, int v = 0);
void checkVaildName(QString s);
~VarExp();
};
class ConstExp : public Exp
{
public:
ConstExp(int v);
~ConstExp();
};
class StringExp : public Exp
{
public:
StringExp(QString n, int v = 0): Exp(n, v) {}
virtual ~StringExp();
};
class IdentifierExp : public Exp
{
public:
IdentifierExp(QString n, int v = 0, Exp* p1 = nullptr, Exp* p2 = nullptr):
Exp(n, v)
{
child.push_back(p1);
child.push_back(p2);
}
~IdentifierExp();
};
#endif // EXP_H
//13 PRINT -1 + 4 MOD 2 + 4 * 3 / 5 ** 8