bug-bison
[Top][All Lists]
Advanced

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

Re: Enhancement request: enabling Variant in C parsers


From: Hans Åberg
Subject: Re: Enhancement request: enabling Variant in C parsers
Date: Thu, 23 Aug 2018 14:17:57 +0200

> On 23 Aug 2018, at 13:17, Akim Demaille <address@hidden> wrote:
> 
>> Le 23 août 2018 à 10:18, Hans Åberg <address@hidden> a écrit :
>> 
>>> 
>>> On 23 Aug 2018, at 07:34, Akim Demaille <address@hidden> wrote:
>>>> The input file is broken.
>>> 
>>> You’ll have to be more specific, WFM.
>> 
>> It generates an error. You might have more than one, say error<k>.txt, and 
>> input<k>.txt.
> 
> That’s not specific.  You say the input file is broken:
> which one, and please show what you have.  Or copy-paste from
> the terminal what goes wrong.

The file named "input" in the calc++ example directory. :-)

>>>> And the location filename gets set to null.
>>> 
>>> Not clear enough, but elaborate.
>> 
>> The location you initialize in .yy is not the one the .ll uses, so it 
>> returns a location with filename set to null, which is then what is 
>> reported, that is nothing. I changed:
>> 
>> calc++.cc: make global
>> extern calcxx_driver driver;
>> 
>> calc++-scanner.ll:
>> calcxx_driver driver;
>> 
>> // The location of the current token.
>> static yy::location loc(&driver.file);
> 
> Good catch, thanks!

You'll have to think over if you want it pure. The filename may belongs to the 
lexer if the parser needs not know about it.

Also the .yy initialization can be:
 %initial-action
 {
   // Initialize the initial location.
   @$.initialize(&driver.file);
 };





reply via email to

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