Re: how to get left hand side symbol in action

Hans Åberg <[email protected]>
Newsgroups gmane.comp.parsers.bison.general
Message-ID <[email protected]>
> On 6 May 2019, at 15:21, uxio prego <[email protected]> wrote:
> 
>> On 6 May 2019, at 14:50, Hans Åberg <[email protected]> wrote:
>> 
>>> On 6 May 2019, at 11:28, r0ller <[email protected]> wrote:
>>> 
>>> 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:"<<???
>>> };
>> 
>> In the C++ parser, one can write:
>> std::cout << “LHS: " << yytname_[yylhs.type_get()] << std::endl;
>> 
>> Used for debugging, perhaps there is a more reliable macro.
> 
> Thanks for the hint.
> Do you mean you know that it won’t work in a C parser or yacc compatibility?

It probably has a similar thing there. Check in the generated parser.



_______________________________________________
[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.