From a743db94541bebafff23c8a490dbce3f55d69712 Mon Sep 17 00:00:00 2001 From: Bobby Bingham Date: Sat, 14 Jan 2017 12:01:13 -0600 Subject: nqasm: Improve parsing at end of file Bison's implicit $accept rule ends with the END token. The fact that input could also end with END (via the line non-terminal) resulted in a shift reduce conflict. We resolve the conflict by modifying the lexer so that if it encounters end of file partway through a line, it produces a final EOL token before EOF. --- parser.y | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'parser.y') diff --git a/parser.y b/parser.y index 78bf123..48bd13f 100644 --- a/parser.y +++ b/parser.y @@ -69,7 +69,7 @@ void yyerror(const char *msg) %type inst %% -input: %empty +input: line | input line ; @@ -151,6 +151,5 @@ inst: T_ADD ; eol: T_EOL - | T_SPACE END - | END + | T_SPACE T_EOL ; -- cgit v1.2.3