Re: How to make C++-generated parser call yylex in some polymorphic way?

2013-12-22 Thread John Horigan
I have used the technique described here: http://panthema.net/2007/flex-bison-cpp-example/ It works with vanilla Bison from 2.3 (maybe earlier) up through 3.0. -- john On Sun, Dec 22, 2013 at 9:04 AM, Oleksii Taran wrote: > Hi all > > Is there a way to not call global C-style `yylex` function

Re: Solving >> issue in templates

2013-02-06 Thread John Horigan
What if you let the lexer emit the SHL token and have your grammar accept '>' tokens or SHL tokens for closing template lists? The action would check if SHL closed the template list and issue a call to the lexer telling it to flush its input and insert another '>' token. -- john On Wed, Feb 6, 20

Re: RAII techniques in semantic actions leading to double deletion

2012-12-06 Thread John Horigan
ser retaining ownership of the symbols for the current action and what the action needs to do if this conflicts with its own memory management. -- john On Thu, Dec 6, 2012 at 12:11 AM, Akim Demaille wrote: > Hi John, > > Le 5 déc. 2012 à 21:43, John Horigan a écrit : > >> My

RAII techniques in semantic actions leading to double deletion

2012-12-05 Thread John Horigan
My C++ grammar file is littered with code like this: sizetime: MODTYPE modification_v2 { exp_ptr mod($2); driver.lexer->maybeVersion = token::CFDG2; if ($1 != ASTmodTerm::size && $1 != ASTmodTerm::time) { error(@1, "Syntax error");

Re: bison and C++ exceptions

2011-08-03 Thread John Horigan
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 t

Re: C++ parser and exceptions in semantic actions

2010-02-23 Thread John Horigan
Ok, I read the generated parser cpp file and it looks like I must have all the try/catch blocks inside my rule actions. It doesn't look like the parser destructor will clean things up properly. So I would like to turn this thread into a feature request thread. It would be very nice if there wer

C++ parser and exceptions in semantic actions

2010-02-23 Thread John Horigan
My C++ bison parser has try/catch blocks sprinkled all over the semantic actions, but the catch block always does the same thing: try { ... stuff ... } catch (CfdgError e) { error(e.where, e.what); YYABORT; } I use auto_ptrs to clean-up