I made a rebase

This commit is contained in:
Meyer Simon
2025-05-06 19:35:49 -04:00
parent 05b347ba63
commit 8c409561b7
4 changed files with 11 additions and 5 deletions

View File

@ -608,6 +608,9 @@ compound_statement:
emit_label(*l);
S_Push(stack, l, 2);
} expression R_PAREN {
emit_conditional_jump(E_IF_X_FALSE, 0, tn_or_const(NODE, $4));
Stack * t = S_Peek(FalseList);
S_Push(t, current, 1);
emit_label(label_gen());
emit_backpatch(S_Pop(TrueList), getLabel(current));
} sblock {
@ -1030,7 +1033,6 @@ expression:
// emit_label(label_gen());
// emit_backpatch(S_Pop(TrueList), getLabel(current));
emit_binary_op(E_LESS_THAN, node, tn_or_const(NODE,$1), tn_or_const(NODE,$3));
/*
emit_conditional_jump(E_IF_X_TRUE, 0, tn_or_const(NODE, node));
Stack * t = S_Peek(TrueList);
if(t==NULL){
@ -1045,6 +1047,7 @@ expression:
S_Push(FalseList, t, 1);
}
S_Push(t, current, 1);
/*
*/
// ----------------------------------------------------------------------------
printdebug("less than expression");
@ -1064,7 +1067,6 @@ expression:
TableNode* node = CreateEntry(cur,TYPE_PRIMITIVE, boo, temp, NULL);
// ----------------------------------------------------------------------------
emit_binary_op(E_EQUAL_TO, node, tn_or_const(NODE,$1), tn_or_const(NODE,$3));
/*
emit_conditional_jump(E_IF_X_TRUE, 0, tn_or_const(NODE, node));
Stack * t = S_Peek(TrueList);
if(t==NULL){
@ -1079,6 +1081,7 @@ expression:
S_Push(FalseList, t, 1);
}
S_Push(t, current, 1);
/*
*/
// emit_label(label_gen());
// emit_backpatch(S_Pop(TrueList), getLabel(current));

View File

@ -316,7 +316,10 @@ void emit_return(TNodeOrConst *value) {
void emit_reserve(TableNode *result, TNodeOrConst *size) {
// this needs to change
// we need to take a int
/*
emit_binary_op(E_MUL, result,
*/
emit_parameter(size);
emit_function_call(result, 1, tn_or_const(NODE, look_up(cur, "reserve")));
}

View File

@ -1489,7 +1489,7 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr) {
if ((getFirstChild(node)) == NULL) {
print_symbol_table(getFirstChild(node), file_ptr);
} else {
if (getLine(getFirstChild(node)) < 0) {
if (getLine(getFirstChild(node)) < -3) {
continue;
} else {
print_symbol_table(getFirstChild(node), file_ptr);