|
From: | Hans Aberg |
Subject: | Re: Print expected tokens in yyerror function. |
Date: | Sun, 9 Mar 2008 16:50:10 +0100 |
On 8 Mar 2008, at 17:47, Necrosoft wrote:
I would know the expected token in a parser (GLR also..l) when yyerror function is invoked. For example: A = aB | bB B = b | c etc....if the string in input is "ad$", in yyerror I would capture correct tokensexpected...like b or c. Ho I can make that?
It prints something like that (or used to), but the LALR(1) that Bison uses compacts the statements in a way that when an error token appears in the input, additional reduction can be performed. So to get a fully correct error handling, including tokens, LR without this type of compaction, or some search algorithm would be needed.
Hans Aberg
[Prev in Thread] | Current Thread | [Next in Thread] |