 | 10.11 Identifiers and operators |
|
| 10 C++ translator |
|
| 10.13 Input/output handling |
|
10.12 Universal types |
10.12 Universal types
The C++ translator generates type names, known as universal types,
from the structure of the maximal type. The universal types are
introduced in order to cope with RSL's maximal type equivalence.
The names of the universal types are constructed from the structure of
the maximal types they represent. Additionally they are given the
prefix RSL_ to ensure that they differ from other names. The
different components and type constructors of a type expression are
represented in the name of the universal type as described below.
RSL | Representation |
Unit | U |
Int | I |
Bool | B |
Real | R |
Char | C |
Text | lC |
Id | Id_NNN |
Q.Id | Id_NNN |
× | -x- |
-set | s- |
-infset | s- |
* | l- |
ω | l- |
-m-> | -m- |
-~m-> | -m- |
→ | -f- |
-~-> | -f- |
( ) | 6-9 |
|
Construction of universal type names
A name is represented by the original name plus a unique extension
(suggested by NNN in the table). Qualifiers are ignored.
An example is the type expression
| | | | | | | | | | | | |
Int × Char -m-> (Bool-set × Real)*
|
which becomes RSL_IxCml6sBxR9
Chris George, April 17, 2008
10.12 Universal types |
 | 10.11 Identifiers and operators |
|
| 10 C++ translator |
|
| 10.13 Input/output handling |
|