help-bison
[Top][All Lists]
Advanced

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

Re: Bison Grammar Rules : Refering to non-terminals semantic value


From: Hans Aberg
Subject: Re: Bison Grammar Rules : Refering to non-terminals semantic value
Date: Tue, 16 Dec 2003 19:32:10 +0100

[Reply to Help-Bison.]
At 18:02 +0100 2003/12/16, Thomas Lavergne wrote:
>The basic problem is that I want to refer to the semantic value of a
>non-terminal symbol from elsewhere than its own rule.

You can't do that: You have to record the value in a global variable, which
then can get accessed by other rules. Lookup tables and such fall into this
category.

> I read also about $0 and $-1 references, but it
>does not seem to apply here, isn't it?

Where did you read about this, i.e., in which version of Bison? Later
versions are 1.75-1.875.

I think that you should only use $k, where k>0, as if the underlying
implemntation of the parser stack is not an array, other values may not
work.

  Hans Aberg






reply via email to

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