Skip to content

Commit 5a3bec1

Browse files
committed
code generation for only function call and return remaining
1 parent cf38068 commit 5a3bec1

File tree

9 files changed

+340
-346
lines changed

9 files changed

+340
-346
lines changed

Main/SIMCode

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +0,0 @@
1-
2-
*** ASSIGNMENT ***
3-
MOV R0 0
4-
MOV [0] R0
5-
6-
*** ITERATION ***
7-
Label0:
8-
MOV R0 [0]
9-
MOV R1 3
10-
LT R0 R1
11-
JZ R0 Label1
12-
13-
*** WRITE ***
14-
MOV R0 [0]
15-
OUT R0
16-
17-
*** ASSIGNMENT ***
18-
MOV R0 [0]
19-
MOV R1 1
20-
ADD R0 R1
21-
MOV [0] R0
22-
JMP Label0
23-
Label1:
24-
25-
*** READ ***
26-
IN R0
27-
MOV [2] R0
28-
29-
*** READ ***
30-
IN R0
31-
MOV [18] R0
32-
33-
*** ASSIGNMENT ***
34-
MOV R0 [2]
35-
MOV R1 [18]
36-
MOV R2 [18]
37-
MUL R1 R2
38-
ADD R0 R1
39-
MOV [0] R0
40-
41-
*** WRITE ***
42-
MOV R0 [0]
43-
OUT R0

SILCompiler/LexYaccFiles/SIL.y

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,10 @@ Parameter : Expr
378378
{ $$ = TreeCreate(0,IDADDR,$2,0,NULL,NULL,NULL,NULL,line);
379379
}
380380

381+
| '&' ID '[' Expr ']'
382+
{ $$ = TreeCreate(0,ARRAYIDADDR,$2,0,NULL,$4,NULL,NULL,line);
383+
}
384+
381385
;
382386

383387
%%

0 commit comments

Comments
 (0)