-
Notifications
You must be signed in to change notification settings - Fork 0
/
expression.h
58 lines (50 loc) · 999 Bytes
/
expression.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
#ifndef EXPRESSION_H
#define EXPRESSION_H
#include <QString>
#include <QList>
#include <QMap>
class Expression
{
public:
Expression();
Expression(const QString &l, QMap<QString, int> &varlist);
~Expression();
static QList<QString>* transToPost(const QString &ss);
int value();
protected:
QList<QString> *revPol;
Expression *preExp;
Expression *postExp;
};
class constantExp: public Expression
{
public:
constantExp(const QString &l, QMap<QString, int> &varlist);
~constantExp();
int value();
private:
int v;
};
class identifierExp: public Expression
{
public:
identifierExp(const QString &l, QMap<QString, int> &varlist);
~identifierExp();
int value();
private:
int v;
QString k;
};
class compondExp
{
public:
compondExp(QList<QString> &l, QMap<QString, int> &varlist);
~compondExp();
int value();
private:
compondExp *cpdexp1;
compondExp *cpdexp2;
QString opr;
int v;
};
#endif // EXPRESSION_H