help-bison
[Top][All Lists]
Advanced

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

Re: Bison Error reporting


From: Akim Demaille
Subject: Re: Bison Error reporting
Date: 14 Dec 2000 15:19:16 +0100
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)

>>>>> "Hans" == Hans Aberg <address@hidden> writes:

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

See my previous message, I think there is no actual problem, just
missing documentation.

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

I got rid of text and filename in the default definition of `simple'.

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

Good question.  The problem is you can't really assume you can print
an unknown token as a char.  Someone might return 424242 in the
scanner, and then?  What can we do?

Personally in my projects it can never happen: there is always a rule
catching unexpected characters in my scanners: the parser never sees
them, they're skipped by the scanner.



reply via email to

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