| 1 |
Syntax: bf(%polymorphic) tt(polymorphic-specification(s)) |
| 2 |
|
| 3 |
The tt(%polymorphic) directive is used to define a polymorphic semantic value |
| 4 |
class, offering a (preferred) alternative to (traditional) tt(union) types. |
| 5 |
|
| 6 |
Refer to section ref(POLYMORPHIC) for a detailed description of the |
| 7 |
specification, characteristics, and use of polymorphic semantic values. |
| 8 |
|
| 9 |
As a quick reference: to define multiple semantic values using a polymorphic |
| 10 |
semantic value class offering either an tt(int), a tt(std::string) or a |
| 11 |
tt(std::vector<double>) specify: |
| 12 |
verb( |
| 13 |
%polymorphic INT: int; STRING: std::string; |
| 14 |
VECT: std::vector<double> |
| 15 |
) |
| 16 |
and use tt(%type) specifications (cf. section ref(TYPE)) to associate |
| 17 |
(non-)terminals with specific semantic value types. |
| 18 |
|
| 19 |
tt(%stype, %union) and tt(%polymorphic) are mutually exclusive: only one |
| 20 |
of these directives can be used. |
| 21 |
|