[Top][All Lists]

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

Re: %type {...} a b c

From: Joel E. Denny
Subject: Re: %type {...} a b c
Date: Wed, 12 Jul 2006 16:14:09 -0400 (EDT)

On Wed, 12 Jul 2006, Akim Demaille wrote:

> >>> "Joel" == Joel E Denny <address@hidden> writes:
>  > I like the idea of equating a semantic type with a type in the
>  > target language rather than with a union field name.  I also see
>  > how modules might conflict on a field name, but types don't have
>  > that problem.
> It also solves one of the issues to support C++ variants in bison,
> where we do not rely on a union, but on a templated structure,
> parametrized by the various types.  That's *if* we use Boost Variants.

I still haven't studied this, and I doubt I'll have time soon.  However, 
in general, I like the idea of making the union an implementation detail 
that the user doesn't have to think much about (POD issues aside).

I was thinking about the syntax of your new %type.  You've been proposing 
something like:

  %type {int} INT


Personally, I like that <...> always delimits a semantic-type.  (I don't 
like that %merge uses it, but that's another can of worms.)  I don't quite 
like using {...} to delimit a semantic type.  For example, how would a 
per-type %destructor/%printer look?

  %destructor { free ($$); } {char *} {int *}

Seems ugly to me.

Why not do something like <{...}>?  So:

  %type <{int}> INT
  %destructor { free ($$}; } <{char *}> <{int *}>

I think it's a little better at least.


reply via email to

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