manpagez: man pages & more
info bison
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.5.1 Data Types of Semantic Values

In a simple program it may be sufficient to use the same data type for the semantic values of all language constructs. This was true in the RPN and infix calculator examples (see section Reverse Polish Notation Calculator).

Bison normally uses the type int for semantic values if your program uses the same data type for all language constructs. To specify some other type, define YYSTYPE as a macro, like this:

 
#define YYSTYPE double

YYSTYPE's replacement list should be a type name that does not contain parentheses or square brackets. This macro definition must go in the prologue of the grammar file (see section Outline of a Bison Grammar).


© manpagez.com 2000-2024
Individual documents may contain additional copyright information.