-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtypeChecker.h
36 lines (28 loc) · 1006 Bytes
/
typeChecker.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
#ifndef _typechecker
#define _typechecker
#include "lexerDef.h"
#include "ast.h"
struct _baseST ;
struct _moduleST ;
struct _varST ;
typedef struct _baseST baseST ;
typedef struct _moduleST moduleST ;
typedef struct _varST varST ;
extern int realPresent ;
extern baseST *realBase ;
// <var> checker
int validVarIndex (moduleST *baseModule, astNode *varIndexASTNode) ;
int validStaticArrStaticIndex (moduleST *baseModule, varST *arrVar, astNode *indASTNode) ;
tokenID validateVar (moduleST *baseModule , astNode *varASTNode, varST **searchedVar) ;
int isLeftLimStatic (varST *arrayVar) ;
int isRightLimStatic (varST *arrayVar) ;
int isVarStaticArr (varST *arrayVar) ;
// Overall function
void assignmentTypeCheck (moduleST *baseModule, astNode *assignopASTNode) ;
// expression checker
int isArithmeticType (tokenID id) ;
int isLogicalOp (tokenID id) ;
int isRelationalOp (tokenID id) ;
int isArithmeticType (tokenID id) ;
tokenID getExpressionType (moduleST *baseModule, astNode *exprNode) ;
#endif