added back scarlett's simple statement work

This commit is contained in:
Annie
2025-04-02 11:23:00 -04:00
parent a81e3e410f
commit 53a4d060b6

View File

@ -261,14 +261,22 @@ compound_statement:
;
simple_statement:
assignable ASSIGN expression {if(strcmp($1, $3) == 0){
} else {
printdebug("Mismatch at line %d and column%d", @2.first_line, @2.first_column);
}}
assignable ASSIGN expression
{
if(strcmp($1, $3) == 0) {
printdebug("Passed standard type check; assignable = expression");
} else if((strcmp($1, "rec") == 0) && (strcmp($3, "address") == 0)) {
printdebug("Passed rec type check; rec = address");
} else if((strcmp($1, "array") == 0) && (strcmp($3, "address") == 0)) {
printdebug("Passed array type check; array = address");
} else {
printdebug("%s[TYPE ERROR] %sMismatch at %sline %d and column %d%s", COLOR_ORANGE, COLOR_WHITE, COLOR_YELLOW, @2.first_line, @2.first_column, COLOR_WHITE);
printdebug(" - Invalid types %s$1: %s and $3: %s%s", COLOR_YELLOW, $1, $3, COLOR_WHITE);
}
}
| RETURN expression
;
rec_op :
DOT