I made a rebase
This commit is contained in:
@ -608,6 +608,9 @@ compound_statement:
|
|||||||
emit_label(*l);
|
emit_label(*l);
|
||||||
S_Push(stack, l, 2);
|
S_Push(stack, l, 2);
|
||||||
} expression R_PAREN {
|
} 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_label(label_gen());
|
||||||
emit_backpatch(S_Pop(TrueList), getLabel(current));
|
emit_backpatch(S_Pop(TrueList), getLabel(current));
|
||||||
} sblock {
|
} sblock {
|
||||||
@ -1030,7 +1033,6 @@ expression:
|
|||||||
// emit_label(label_gen());
|
// emit_label(label_gen());
|
||||||
// emit_backpatch(S_Pop(TrueList), getLabel(current));
|
// 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_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));
|
emit_conditional_jump(E_IF_X_TRUE, 0, tn_or_const(NODE, node));
|
||||||
Stack * t = S_Peek(TrueList);
|
Stack * t = S_Peek(TrueList);
|
||||||
if(t==NULL){
|
if(t==NULL){
|
||||||
@ -1045,6 +1047,7 @@ expression:
|
|||||||
S_Push(FalseList, t, 1);
|
S_Push(FalseList, t, 1);
|
||||||
}
|
}
|
||||||
S_Push(t, current, 1);
|
S_Push(t, current, 1);
|
||||||
|
/*
|
||||||
*/
|
*/
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
printdebug("less than expression");
|
printdebug("less than expression");
|
||||||
@ -1064,7 +1067,6 @@ expression:
|
|||||||
TableNode* node = CreateEntry(cur,TYPE_PRIMITIVE, boo, temp, NULL);
|
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_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));
|
emit_conditional_jump(E_IF_X_TRUE, 0, tn_or_const(NODE, node));
|
||||||
Stack * t = S_Peek(TrueList);
|
Stack * t = S_Peek(TrueList);
|
||||||
if(t==NULL){
|
if(t==NULL){
|
||||||
@ -1079,6 +1081,7 @@ expression:
|
|||||||
S_Push(FalseList, t, 1);
|
S_Push(FalseList, t, 1);
|
||||||
}
|
}
|
||||||
S_Push(t, current, 1);
|
S_Push(t, current, 1);
|
||||||
|
/*
|
||||||
*/
|
*/
|
||||||
// emit_label(label_gen());
|
// emit_label(label_gen());
|
||||||
// emit_backpatch(S_Pop(TrueList), getLabel(current));
|
// emit_backpatch(S_Pop(TrueList), getLabel(current));
|
||||||
|
@ -316,7 +316,10 @@ void emit_return(TNodeOrConst *value) {
|
|||||||
void emit_reserve(TableNode *result, TNodeOrConst *size) {
|
void emit_reserve(TableNode *result, TNodeOrConst *size) {
|
||||||
// this needs to change
|
// this needs to change
|
||||||
// we need to take a int
|
// we need to take a int
|
||||||
|
/*
|
||||||
emit_binary_op(E_MUL, result,
|
emit_binary_op(E_MUL, result,
|
||||||
|
*/
|
||||||
|
emit_parameter(size);
|
||||||
emit_function_call(result, 1, tn_or_const(NODE, look_up(cur, "reserve")));
|
emit_function_call(result, 1, tn_or_const(NODE, look_up(cur, "reserve")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1489,7 +1489,7 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr) {
|
|||||||
if ((getFirstChild(node)) == NULL) {
|
if ((getFirstChild(node)) == NULL) {
|
||||||
print_symbol_table(getFirstChild(node), file_ptr);
|
print_symbol_table(getFirstChild(node), file_ptr);
|
||||||
} else {
|
} else {
|
||||||
if (getLine(getFirstChild(node)) < 0) {
|
if (getLine(getFirstChild(node)) < -3) {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
print_symbol_table(getFirstChild(node), file_ptr);
|
print_symbol_table(getFirstChild(node), file_ptr);
|
||||||
|
Reference in New Issue
Block a user