help-bison
[Top][All Lists]
Advanced

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

Re: bison and C++ exceptions


From: John Horigan
Subject: Re: bison and C++ exceptions
Date: Wed, 3 Aug 2011 13:36:27 -0400

It would be nice if YYABORT, YYERROR, and YYACCEPT were all implemented as 
exception throws, instead of gotos. Then you could throw them deep in your AST 
class and still have Bison do the right thing. Then Bison could catch all other 
exceptions, clean up, and rethrow the non-Bison exception up to the 
parser-caller.

-- john

On Jun 13, 2011, at 11:19 AM, Akim Demaille wrote:

> 
> Le 24 mai 2011 à 20:32, Sergey Klimkin a écrit :
> 
>> Hi!
> 
> Hi!
> 
>> Trying to find information about C++ exceptions in semantic actions, with no
>> results.
>> Is there any Bison %Decl which allows to move parse stack outside yyparse(),
>> to destroy a stack values after an exception was thrown within semantic
>> action!?
> 
> This was not considered when writing the C++ parser skeleton :(  Parsing is 
> expected to be interrupted with YYERROR or YYABORT/YYACCEPT.  So if there are 
> not too many actions that need to be wrapped, then maybe you can catch the 
> exception, save it, YYABORT, and rethrow from the parser-caller?
> 
> Your request is legitimate, this is something we should address.
> _______________________________________________
> address@hidden https://lists.gnu.org/mailman/listinfo/help-bison




reply via email to

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