help-bison
[Top][All Lists]
Advanced

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

Re: Tree-like construction while parsing the input file


From: Ilyes Gouta
Subject: Re: Tree-like construction while parsing the input file
Date: Sun, 11 Jan 2009 18:37:59 +0100

Hi Hans,

item_list:
>> |   item_declaration item_list
>> ;
>>
>
> But sometimes one can do a trick by combining non-terminals into one rule.
> Then the parse tree of those before will be constructed before those latter.
> In your example, item_declaration will be constructed before item_list, so
> one can have actions
>  item_declaration {...} item_list {...}
> Here, the first action {...} can only use the item_declaration value, but
> the second can use all that comes before. - See the Bison manual for
> details.


At the end of that rule, the value of item_declaration is $1 and item_list
is $2 and the overall return value is $$. What would be the value of
item_declaration in my action if I put the latter just straight after it
(not at the end of the rule)?

item_list:
| item_declaration { action1(&*$?*); } item_list { link_nodes(&$$); }

Regards,
Ilyes Gouta.


reply via email to

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