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 tokens
expected...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




_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to