Re: how to get left hand side symbol in action

Akim Demaille <[email protected]>
Newsgroups gmane.comp.parsers.bison.general
Message-ID <[email protected]>

> Le 6 mai 2019 à 14:50, Hans Åberg <[email protected]> a écrit :
> 
> 
>> On 6 May 2019, at 11:28, r0ller <[email protected]> wrote:
>> 
>> Hi All,
>> 
>> Is it possible in *any* way to get the left hand side symbol in an action of a rule? Say, I have:
>> 
>> A : B C
>> {<!-- -->
>>    std:cout<<"left hand side symbol is:"<<???
>> };
>> 
>> I tried to find it out myself and googled a lot but didn't find anything:(
> 
> In the C++ parser, one can write:
>  std::cout << “LHS: " << yytname_[yylhs.type_get()] << std::endl;

But it's an internal detail, there is no guarantee it won't change.

r0ller, what is your exact need?
_______________________________________________
[email protected] https://lists.gnu.org/mailman/listinfo/help-bison
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.