DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(bison.info) Union Decl

Info Catalog (bison.info) Precedence Decl (bison.info) Declarations (bison.info) Type Decl
 
 The Collection of Value Types
 -----------------------------
 
    The `%union' declaration specifies the entire collection of possible
 data types for semantic values.  The keyword `%union' is followed by a
 pair of braces containing the same thing that goes inside a `union' in
 C.
 
    For example:
 
      %union {
        double val;
        symrec *tptr;
      }
 
 This says that the two alternative types are `double' and `symrec *'.
 They are given names `val' and `tptr'; these names are used in the
 `%token' and `%type' declarations to pick one of the types for a
 terminal or nonterminal symbol ( Nonterminal Symbols Type Decl.).
 
    Note that, unlike making a `union' declaration in C, you do not write
 a semicolon after the closing brace.
 
Info Catalog (bison.info) Precedence Decl (bison.info) Declarations (bison.info) Type Decl
automatically generated byinfo2html