i wrote a small lexer/parser using lex/yacc. i'm using c++ as the
language to interface with lex/yacc. i have the following user defined
struct for YYSTYPE to populate the data that is parsed

* This union is used by the yyparse() routine to hold the information
* that is accumulated during the parsing of a technology library
* As tokens are collected, and rules from the grammar are
* deduced, the data can be stored by creating one of the appropriate
* structures and populating it with values.
typedef union MY_YYSTYPE
TechLib::Element *element; /*!< An element is a gate
or a latch. */
TechLib::Gate *gate; /*!< A logic gate. */
TechLib::Expression *expr; /*!< The logic expression of
an element. */
TechLib::Function *function; /*!< Logic function of an
element. */
TechLib::Pin *pin; /*!< Pin information
about a pin. */
list *pinlist; /*!< A list of pins. */
TechLib::Latch *latch; /*!< A latch. */
TechLib::Constraint *cst; /*!< Constraints on the
latch. */
list *cstlist; /*!< List of constraints. */
TechLib::Clock *clk; /*!< The latch's
clock. */
string *str; /*!< An
identifier. */
double val; /*!< A float
value. */
TechLib::Pin::PhaseT phase; /*!< Phase of an input.
TechLib::Latch::TypeT latchtype; /*!< Type of latch. */

as you can see its a bunch of pointers. in my yacc grammar i have to
do a bunch of new/delete statements. i would like to avoid this if
possible. that is, i want to make YYSTYPE hold objects (and not
pointers to objects). one person was telling me that i should put all
the above as objects (and not as pointers) inside a struct and then
have an anonymous union inside this struct as well which contains
pointers. i didn't understand him very clearly so i am not sure how to
go about implementing it. i'm not sure what i have to do on this. i'd
like to avoid using new/delete as much as possible to make it easier
on myself when debugging. i would appreciate if anyone can help me.

thanks for your time.