-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtranslate.h
More file actions
60 lines (46 loc) · 1.24 KB
/
translate.h
File metadata and controls
60 lines (46 loc) · 1.24 KB
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
#ifndef translate_h
#define translate_h
#include "ast.h"
#include "semantic.h"
#include "medCode.h"
static char nodeType[23][32]={
"Program",
"ExtDefList",
"ExtDef",
"ExtDecList",
"Specifier",
"TYPE",
"StructSpecifier",
"OptTag",
"Tag",
"VarDec",
"FunDec",
"VarList",
"ParamDec",
"CompSt",
"StmtList",
"Stmt",
"DefList",
"Def",
"DecList",
"Dec",
"Exp",
"Relop",
"Args"
};
// Determine the type of nonterminal
int vnType(char *name);
void translate(Node *pNode);
/*
* Translate exp.
* option = 0: Passive: The upper layer of the place only provides the position, and there is no left value. If you fill in any, the upper layer will be used directly, for example, you can fill in the immediate data.
* option = 1: Active: The place is a variable given by the upper layer, please put your result in place.
* If place==NULL, then this layer does not generate a variable.
*/
void translateExp(Node *pNode, char *place, int option);
// Translation parameter list
void translateArgs(Node* pNode, int funIndex, int pnum, int count);
// Translate conditional codes, jump according to the label from the upper layer
void translateCond(Node* pNode, char* labelTrue, char* labelFalse);
void getLocation(Node*pNode, char* place);
#endif