[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Token types with constructor
From: |
Martin Trautmann |
Subject: |
Re: Token types with constructor |
Date: |
Sat, 28 Aug 2004 20:52:47 +0200 |
Hi Laurence, hi Hans,
>From your discussion I know that you propose two ways of integrating
bison in a C++ framework. But I am not happy with both ways:
1) I would like to use a well supported parser template which works in
future versions of bison in the same way (It doesn't seem to me that the
bison team really stands behind the C++ extension)
2) I don't want to use new and delete in every rule (that is why I don't
like to use pointers to Objects)
What is the problem with the following code in the current bison
version:
class Token
{
std::string str;
int i;
};
#define YYSTYPE Token
The problem is that the token is stored within a union.
Extract of yacc.c:
union yyalloc
{
short yyss;
YYSTYPE yyvs;
};
So there is a very easy fix for that problem that only costs two byte
per Token:
struct yyalloc
{
short yyss;
YYSTYPE yyvs;
};
What about changing this in future versions of bison or offering an
option within the official version to allow Token types with
constructors?
bye
Martin
- Token types with constructor, Martin Trautmann, 2004/08/25
- Re: Token types with constructor, Laurence Finston, 2004/08/25
- Re: Token types with constructor, Hans Aberg, 2004/08/27
- Re: Token types with constructor, Laurence Finston, 2004/08/26
- Re: Token types with constructor, Hans Aberg, 2004/08/27
- Re: Token types with constructor, Laurence Finston, 2004/08/27
- Re: Token types with constructor,
Martin Trautmann <=
- Re: Token types with constructor, Laurence Finston, 2004/08/28
- Re: Token types with constructor, Hans Aberg, 2004/08/29
- Message not available
- Re: Token types with constructor, Hans Aberg, 2004/08/31
- Message not available
- Re: Token types with constructor, Hans Aberg, 2004/08/29
Re: Token types with constructor, Hans Aberg, 2004/08/26