[comp.sources.bugs] yacc misfeature

ken@rochester.arpa (Ken Yap) (07/18/87)

Speaking of yacc bugs, how come nobody has complained about this one?

In the parser skeleton there are a few lines like this

#ifndef	YYSTYPE
#define	YYSTYPE	int
#endif

When the %union feature is used, this creates a union typedef for
YYSTYPE.  Unfortunately, a typedef is not a #define and the default
type isn't overidden. In the end I sent y.tab.c through a sed script to
remove the #define.

Maybe people don't use %union that much? It really is nifty.

	Ken

charles@hpcvcd.HP (Charles Brown) (07/19/87)

>When the %union feature is used, this creates a union typedef for
>YYSTYPE.  Unfortunately, a typedef is not a #define and the default
>type isn't overidden. In the end I sent y.tab.c through a sed script to
>remove the #define.
>
>Maybe people don't use %union that much? It really is nifty.
>	Ken

I am using %union without sed and without problems.  I am using HP-UX
on an HP9000s500.  This is a derivative of Ma Bell Un*x.

Perhaps your yacc is broken.

	Charles Brown		hplabs!hp-pcd!charles

HP-UX is probably a trademark of Hewlett-Packard.
Un*x is not a trademark of Ma Bell.