help-bison
[Top][All Lists]
Advanced

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

Re: yytname woes


From: Hans Åberg
Subject: Re: yytname woes
Date: Mon, 13 Nov 2023 19:14:55 +0100

> On Nov 12, 2023, at 18:18, James K. Lowden <jklowden@schemamania.org> wrote:
> 
> On Mon, 13 Nov 2023 10:52:02 +0100
> Hans Åberg <haberg-1@telia.com> wrote:
> 
>>> Let's start, shall we, with "is it a bug"?  
>> 
>> The parser knows how to translate token numbers into names for error
>> messages, but there is no API for that as far as I know.
> 
> I disagree.  Bison might know how to do that, but "the parser" does
> not.

Read the generated parser code: Error message strings are generated by 
translating token numbers into symbol names, first into the symbol-number 
mentioned.

>  Bison is a parser-generator.  I'm writing "the parser" using
> Bison. I implemented yyerror(). I'm producing the error message using
> the only vehicle I've found, yytname.  It's insufficient to the
> purpose.

It generates an error message string, which one is expected to use. Not the 
internal tables directly.





reply via email to

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