Fix integer comparisons

This commit is contained in:
cannoli-fruit 2026-07-31 01:27:10 -04:00
commit 913aa8523e

View file

@ -405,14 +405,14 @@ codegenIR:
break; break;
} }
if (SBeq(&tokenAccumulator, "if")) { if (SBeq(&tokenAccumulator, "if")) {
lz_da_append(labelStack, counter);
commentStack(&labelStack);
break; break;
} }
if (SBeq(&tokenAccumulator, "then")) { if (SBeq(&tokenAccumulator, "then")) {
IRComplete(&irStatements, &irVStack); IRComplete(&irStatements, &irVStack);
vstackUnderflows = 0;
lz_da_append(labelStack, counter);
commentStack(&labelStack); commentStack(&labelStack);
vstackUnderflows = 0;
int lbl = lz_da_pop(labelStack); int lbl = lz_da_pop(labelStack);
lz_da_append(labelStack, lbl); lz_da_append(labelStack, lbl);
printf(" popstack 123\n"); printf(" popstack 123\n");
@ -452,7 +452,7 @@ codegenIR:
} else if (irVStack.cnt == 0) { } else if (irVStack.cnt == 0) {
x1 = (IRValue) { x1 = (IRValue) {
.typ = IRVAL_STACK, .typ = IRVAL_STACK,
.val = 1 .val = ++vstackUnderflows
}; };
} }
IRValue dstReg = (IRValue) { IRValue dstReg = (IRValue) {
@ -716,7 +716,7 @@ codegenIR:
}; };
IRStatement s = (IRStatement) { IRStatement s = (IRStatement) {
.dst = dstReg, .dst = dstReg,
.op = IR_ILT, .op = IR_IGT,
.arg1 = x1, .arg1 = x1,
.arg2 = x2 .arg2 = x2
}; };
@ -732,7 +732,7 @@ codegenIR:
}; };
IRStatement s = (IRStatement) { IRStatement s = (IRStatement) {
.dst = dstReg, .dst = dstReg,
.op = IR_IGT, .op = IR_ILT,
.arg1 = x1, .arg1 = x1,
.arg2 = x2 .arg2 = x2
}; };