-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrel.h
More file actions
28 lines (26 loc) · 671 Bytes
/
rel.h
File metadata and controls
28 lines (26 loc) · 671 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
#ifndef __rel_h__
#define __rel_h__
#include "logical.h"
#include "type.h"
class Rel : public Logical{
public:
Rel(Token *tok , Expr *x1 , Expr *x2)
:Logical(tok,x1,x2){
type = check(expr1->type,expr2->type);
};
virtual Type *check(Type *p1 , Type *p2)
{
if(p1->isArray() || p2->isArray()){
return NULL;
}else if(p1 == p2) return Type::Bool();
else return NULL;
}
void jumping(int t,int f)
{
Expr *a = expr1->reduce();
Expr *b = expr2->reduce();
std::string test = a->toString() + " " + op->toString() + " " + b->toString();
emitjumps(test,t,f);
}
};
#endif