help-bison
[Top][All Lists]
Advanced

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

Re: C++, %glr-parser and non-POD semantic values


From: Hans Aberg
Subject: Re: C++, %glr-parser and non-POD semantic values
Date: Tue, 29 May 2007 13:17:58 +0200

On 29 May 2007, at 11:49, Frans Englich wrote:

I'm switching a parser to be GLR in order to simplify the lexer. It's all in C++, the parser & tokenizer must be exceptions safe(hence, Bison destructors cannot be used to free values, as far as I know), and it must be reentrant.

My current parser does not use the C++ skeleton despite being compiled as C++
code, which from my understanding is bad practice(correct?).

I don't know about the GLR parser, but the ordinary C parser stack does not invoke the copy constructors correctly when it reallocates: it just copies over the memory data.

My semantic
value is a class with non-POD members; I don't use %union.

So either use a semantic type which does not use non-trivial copy constructors, or a stack that does not re-allocate (using say std::vector or std::deque), or a C++ stack.

  Hans Aberg







reply via email to

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