help-bison
[Top][All Lists]
Advanced

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

Re: About %destructor is c++ mode


From: Min Wang
Subject: Re: About %destructor is c++ mode
Date: Thu, 18 Aug 2016 10:03:40 -0400

HI

@Hans. Thanks.


So I should use

%type <PROG> PROG


instead of

%type <PROG*> PROG

?

Thus I do not need %destructor at all?


thanks.

min


On Thu, Aug 18, 2016 at 9:49 AM, Hans Åberg <address@hidden> wrote:

>
> > On 18 Aug 2016, at 15:24, Min Wang <address@hidden> wrote:
>
> > (1)  for the error recovery,  should I always include "error" in each
> rule?
>
> Only at the place wher e you want to have recovery.
>
> > what if I do not have error in these rules, does the parser() just return
> > failed? it seems it will call that %destructor as well.
>
> It will unwind the whole stack and terminate.
>
> > (2) Could you explain more on  "rely on C++ cleanup”?
>
> C++ automatic variables, as the std::string in your first example. The
> parser uses std::deque by default, so the C++ destructors are called
> properly.
>
>
>


-- 
http://www.comrite.com


reply via email to

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