help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bison Error reporting


From: Hans Aberg
Subject: Bison Error reporting
Date: Thu, 7 Dec 2000 16:56:22 +0100

I am looking a bit on Bison's error reporting, with the aim to make Bison
to produce a parser providing as much information as possible about an
error:

- One can define YYLTYPE for use with the @n variables, but there seems to
be no way one can get that info into the yyerror() function. That is,
should one not be able to have say a prototype
  yyerror(const std::string&, YYLTYPE);
and when an error occurs, one can use the YYLTYPE in order to produce that
error message. Or is it easy to use this information anyway?

- Bison seems to not enforce any structure on YYLTYPE, so one could define
it to anything, whereas the manual says one has to use
  struct { int first_line, last_line, first_column, last_column; };
Which one is correct? That is, can YYLTYPE be defined to anything?
(Speaking about Bison.simple -- Bison.hairy seems to make such assumptions
about YYLTYPE, I recall, with an additional filed for time.)

- If Bison encounters an undefined token it calls it "$undefined.", usually
a sporadic character from the lexer. Is it easy to make the error reporting
instead writing out which character this is? (Apart from defining a token
for every character.)

  Hans Aberg





reply via email to

[Prev in Thread] Current Thread [Next in Thread]