Skip to content

Commit

Permalink
Bug Fixes
Browse files Browse the repository at this point in the history
Co-Authored-By: Henrique <[email protected]>
  • Loading branch information
RafaelBarbon and h-ssiqueira committed Nov 23, 2022
1 parent 899daa7 commit a980fb8
Show file tree
Hide file tree
Showing 7 changed files with 218 additions and 94 deletions.
58 changes: 24 additions & 34 deletions AssemblyCode.obj
Original file line number Diff line number Diff line change
@@ -1,47 +1,37 @@
START
ALLOC 0 1
ALLOC 1 3
ALLOC 1 1
JMP 1
2 NULL
ALLOC 4 3
ALLOC 7 1
JMP 3
4 NULL
RD
STR 4
RD
STR 5
ALLOC 2 1
LDV 1
LDC 1
CEQ
JMPF 3
LDC 1
JMP 4
3 NULL
LDV 1
STR 2
LDV 1
LDC 1
SUB
STR 1
LDV 2
CALL 2
LDV 0
STR 6
LDV 6
PRN
RETURN
5 NULL
ALLOC 8 1
RD
STR 8
LDV 8
LDC 10
CME
JMPF 6
CALL 4
6 NULL
DALLOC 8 1
RETURN
3 NULL
CALL 5
LDV 4
LDV 5
ADD
MULT
4 NULL
STR 0
DALLOC 4 4
DALLOC 2 1
RETURNF
1 NULL
RD
STR 1
CALL 2
LDV 0
STR 3
LDV 3
STR 1
LDV 1
PRN
DALLOC 0 4
DALLOC 0 2
HLT
3 changes: 1 addition & 2 deletions src/codeGeneration.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ void generateExpressionCode(ExpressionAnalyzer *posFix, Symbol *symbol) {
generateAssembly("INV ", 0, 0);
break;
case UnarioP:
continue;
break;
case OpMultDiv:
if(isEqualString(posFix->lexeme, "*"))
Expand All @@ -264,7 +263,7 @@ void generateExpressionCode(ExpressionAnalyzer *posFix, Symbol *symbol) {
generateAssembly("CMAQ ", 0, 0);
else if(isEqualString(posFix->lexeme, "!="))
generateAssembly("CDIF ", 0, 0);
else if(isEqualString(posFix->lexeme, "=="))
else if(isEqualString(posFix->lexeme, "="))
generateAssembly("CEQ ", 0, 0);
break;
case Nao:
Expand Down
Loading

0 comments on commit a980fb8

Please sign in to comment.