help-bison
[Top][All Lists]
Advanced

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

Re: %union errors that shouldn't be there


From: Hans Aberg
Subject: Re: %union errors that shouldn't be there
Date: Mon, 21 Mar 2005 19:20:36 +0100

At 11:55 +0100 2005/03/21, Laurence Finston wrote:
On Sun, 20 Mar 2005, DYP wrote:

 In file included from misery.ll:30:
 gram.yy:26: error: ISO C++ forbids declaration of `astNode' with no type
 gram.yy:26: error: expected `;' before '*' token
 gram.yy:27: error: ISO C++ forbids declaration of `string' with no type
 gram.yy:27: error: expected `;' before '*' token
 gram.yy:28: error: ISO C++ forbids declaration of `nodeList' with no
 type
 gram.yy:28: error: expected `;' before '*' token


Apparently, your types `astNode', `string', and `nodeList' are undefined
when your `%union' declaration is being compiled.  Assuming you're using
C, My guess is that you're not including the header file or files that
declare them in your parser input file.  On the other hand, if you're
using C++, it might be because these are types that can't be included in
`unions'.  I don't remember the rule off-hand --- it has something to do
with constructors and/or destructors.  I don't know whether this
programming error would cause this particular compiler error to be
signalled, though, and I don't have time to test this myself at the
moment.

They should be OK in C++, as pointers do not have non-trival con-/de-structors. The compiler needs to see a declaration of the name as a type, though, before it sees the pointer.
--
  Hans Aberg




reply via email to

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