help-bison
[Top][All Lists]
Advanced

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

Re: Type checking in semantic actions


From: Hans Aberg
Subject: Re: Type checking in semantic actions
Date: Tue, 16 Feb 2010 00:22:24 +0100

On 15 Feb 2010, at 22:25, Michael Budach wrote:

So you need to assign config_spec a valid value somewhere, or write a
rule that initializes $$ instead of the default rule.

Does that mean it is possible to redefine the default rule from
"$$ = $1;" to e.g. "$$=NULL;" ?

Can you tell me how ? I did not find anything like that in the documentation.

You can change the skeleton file. This is a hack, because when it is developed, if you want a new, you need to tweak it to get it updated. But if you have some suggestions, and there is a general interest, it might be integrated.

Anyway, the skeleton files are on my system located in /usr/local/ share/bison/. Copy the one you want to use, and in it, look for a statement:
  switch (n_) {
    default:
      ...
  }
Change the ... to what you want it to be.

Then add %skeleton "<filename>" to your .y file. It will look for it in the same directory, or some of the common locations.

  Hans







reply via email to

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