help-bison
[Top][All Lists]
Advanced

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

Re: Feature request


From: Hans Aberg
Subject: Re: Feature request
Date: Thu, 21 Jun 2007 11:26:55 +0200

On 21 Jun 2007, at 08:36, Fernando Ferreira wrote:

Yes, and that would work, but them every time I recompile the .yy file with bison I would have to manually change the .cc to include the modification. That's why I think it would be helpful to have a macro similar to flex' YY_USER_ACTION, so I could embed it in the .yy prologue.

You modify the skeleton file, and put the modified version in the directory where the parser file is output and add %skeleton to the .y or .yy file. For C++, it is lalr1.cc. They are in bison/ data. It will take longer to get the feature, so don't hold your breath. :-)

And that solves my problems, present, future and imaginary :D How could I miss such obvious solution is beyond my comprehension, thank you very much, changing the skeleton is exactly what I should be doing from the very beginning. Having it changed for the future versions would be am interesting addition, but as far as my needs goes, changing the skeleton is the way to go. Thanks a lot.

It only solves your problem until the distributed skeleton file is being updated, when you will have to tweak the new to get the update. In order to make it simple for you, you might add a macro in the skeleton file. One variation might be (don't remember) to add a macro something like b4_prereduction_code and then use in the .y file % define prereduction_code {...} (or %define "prereduction_code" {...}). There has been talk about adding more places to add code, but don't hold your breath.

  Hans Aberg






reply via email to

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