help-bison
[Top][All Lists]
Advanced

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

Re: how to get left hand side symbol in action


From: Hans Åberg
Subject: Re: how to get left hand side symbol in action
Date: Mon, 6 May 2019 14:50:38 +0200

> On 6 May 2019, at 11:28, r0ller <address@hidden> 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;

Used for debugging, perhaps there is a more reliable macro.





reply via email to

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