File: unionshorthand.yo

package info (click to toggle)
bisonc%2B%2B 6.09.02-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,984 kB
  • sloc: cpp: 9,375; ansic: 1,505; fortran: 1,134; makefile: 1,062; sh: 526; yacc: 84; lex: 60
file content (15 lines) | stat: -rw-r--r-- 807 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
The tt(%union) directive is used to specify a union of semantic value types.
Although each semantic value type can be used for each tt(STYPE_) variable,
(non)terminals are in practice associated with a single type. These
associations are automatically applied through b()'s  dollar-notations.

Note that the tt(%union) directive is now largely superseded by the facilities
offered by the tt(%polymorphic) directive. Using tt(%union) is considered
somewhat `old school', as tt(%polymorphic) implements cleaner type
definitions, allowing b() and the bf(C++) compiler to verify that types are
correctly being used.

In the next overview the notation $1 is used as a generic reference to
semantic values of production rule components. Instead of $1 other available
numbered dollar references can also be used.