File tree Expand file tree Collapse file tree 3 files changed +6
-9
lines changed Expand file tree Collapse file tree 3 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -12,10 +12,10 @@ return
12
12
.limit stack 100
13
13
.line 1
14
14
iconst_0
15
- istore_2
15
+ istore_1
16
16
iconst_0
17
- istore_3
17
+ istore_2
18
18
fconst_0
19
- fstore_4
19
+ fstore_3
20
20
return
21
21
.end method
Original file line number Diff line number Diff line change @@ -68,27 +68,24 @@ namespace semantic_actions_util {
68
68
void defineVariable (string name, int varType) {
69
69
declareVariable (name, varType);
70
70
if (varType == INT_TYPE) {
71
- appendToCode (" iconst_0\n istore_" + to_string (currentVariableIndex));
71
+ appendToCode (" iconst_0\n istore_" + to_string (currentVariableIndex - 1 ));
72
72
} else if (varType == FLOAT_TYPE) {
73
- appendToCode (" fconst_0\n fstore_" + to_string (currentVariableIndex));
73
+ appendToCode (" fconst_0\n fstore_" + to_string (currentVariableIndex - 1 ));
74
74
}
75
75
76
76
}
77
77
78
78
void generateHeader () {
79
79
// TO-DO get file name
80
80
// appendToCode(".source " + outfileName);
81
- appendToCode (" .class public test \n .super java/lang/Object\n " );
81
+ appendToCode (" .class public java_class \n .super java/lang/Object\n " );
82
82
appendToCode (" .method public <init>()V" );
83
83
appendToCode (" aload_0" );
84
84
appendToCode (" invokenonvirtual java/lang/Object/<init>()V" );
85
85
appendToCode (" return" );
86
86
appendToCode (" .end method\n " );
87
87
appendToCode (" .method public static main([Ljava/lang/String;)V" );
88
88
appendToCode (" .limit locals 100\n .limit stack 100" );
89
-
90
-
91
-
92
89
appendToCode (" .line 1" );
93
90
}
94
91
You can’t perform that action at this time.
0 commit comments