updated errok placements

This commit is contained in:
Partho
2025-04-28 00:06:54 -04:00
parent 31e8517601
commit 49b83cd8ad
2 changed files with 7 additions and 24 deletions

View File

@ -4,7 +4,7 @@ FLEX := flex
BISON = bison
CFLAGS := -ggdb
BISONFLAGS := -d
BISONFLAGS := -d -Wcounterexamples
LEX := src/lexicalStructure.lex
YACC := src/grammar.y

View File

@ -106,7 +106,6 @@
program:
prototype_or_definition_list
| error { yyerrok; }
;
@ -116,7 +115,8 @@ prototype_or_definition_list:
| definition prototype_or_definition_list
| prototype
| definition
| error { yyerrok; }
| prototype error { yyerrok; }
| definition error { yyerrok; }
;
@ -124,8 +124,6 @@ prototype_or_definition_list:
prototype:
L_PAREN EXTERNAL R_PAREN FUNCTION ID COLON ID
| error { yyerrok; }
;
@ -356,8 +354,6 @@ idlist:
printdebug("tag is %d", getAdInfoType(entry));
}
| error { yyerrok; }
;
@ -406,8 +402,6 @@ sblock:
R_BRACE
{$$ = $5;}
| error { yyerrok; }
;
@ -427,7 +421,6 @@ dblock:
}
declaration_list R_BRACKET
| error { yyerrok; }
;
@ -436,8 +429,7 @@ dblock:
declaration_list:
declaration SEMI_COLON declaration_list
| declaration
| error { yyerrok; }
| error SEMI_COLON { yyerrok; } declaration_list //only perform error recovery once we see semi-colon
;
@ -478,8 +470,6 @@ declaration:
}
}
| error { yyerrok; }
;
@ -497,8 +487,6 @@ id_or_types:
$$ = (TableNode*)$1;
}
| error { yyerrok; }
;
@ -550,6 +538,7 @@ compound_statement statement_list {
| simple_statement SEMI_COLON {
$$ = $1;
}
| error SEMI_COLON { yyerrok; } statement_list { $$ = $4; }
;
@ -631,8 +620,8 @@ simple_statement:
| RETURN expression {$$ = getTypeEntry((TableNode*)$2);}
|simple_statement error {yyerrok; printdebug("error in simple statement");}
| error { yyerrok; }
;
@ -641,7 +630,6 @@ simple_statement:
rec_op:
DOT
| error { yyerrok; }
;
@ -653,7 +641,6 @@ ablock:
printdebug("ablock is %d", $$);
}
| error { yyerrok; }
;
@ -674,7 +661,6 @@ argument_list:
$$ = 1; printdebug("[ARGUMENT_LIST] argument list is %d", $$);
}
| error { yyerrok; }
;
@ -873,8 +859,6 @@ expression:
}
}
| error { yyerrok; }
;
//UPDATED $$ for tablenodes to this point
@ -1058,7 +1042,6 @@ assignable:
printdebug("[ASSIGNABLE - RULE 3] record = name: %s | field = %s", getName((TableNode*)($1)), getName((TableNode*)$3));
}
| error { yyerrok; }
;
@ -1075,7 +1058,6 @@ memOp:
printdebug("release expression");
}
| error { yyerrok; }
;
@ -1260,3 +1242,4 @@ void yyerror(const char *err) {
}
}
}