From 53a4d060b6d31ad6f11848497a6364fd4d3fd018 Mon Sep 17 00:00:00 2001 From: Annie Date: Wed, 2 Apr 2025 11:23:00 -0400 Subject: [PATCH] added back scarlett's simple statement work --- src/grammar.y | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/grammar.y b/src/grammar.y index ba66d6b..6edd68f 100644 --- a/src/grammar.y +++ b/src/grammar.y @@ -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