Updated Programming language specification (Gemstone) (markdown)
parent
4304c97bd4
commit
83f5903c23
|
@ -8,12 +8,15 @@ The most fundamental types of data. They provide the base upon everything else i
|
||||||
| `int` | 4 | signed integer stored as two's complement with the MSB representing the sign bit |
|
| `int` | 4 | signed integer stored as two's complement with the MSB representing the sign bit |
|
||||||
| `float` | 4 | signed single precision floating point as specified by IEEE-754 |
|
| `float` | 4 | signed single precision floating point as specified by IEEE-754 |
|
||||||
|
|
||||||
|
### Automatic type coercion
|
||||||
|
Primitive types `int` and `float` are automatically converted into each other upon need. This is a lossy conversion. A float may not have the precision to store every digit of a given integer. Likewise the fraction of any float will be truncated.
|
||||||
|
|
||||||
## Composite data types
|
## Composite data types
|
||||||
Primitive data types provide the foundation upon which direct derivations can be built. The derivations of primitive types we call composite types. A composite type modifies or extends the definition of a primitive or another composite type.
|
Primitive data types provide the foundation upon which direct derivations can be built. The derivations of primitive types we call composite types. A composite type modifies or extends the definition of a primitive or another composite type.
|
||||||
Extensions or modifications can mean adding or removing a sign bit, exchanging the arithmetic model, etc.
|
Extensions or modifications can mean adding or removing a sign bit, exchanging the arithmetic model, etc.
|
||||||
The declaration of a composite data type is made with the following syntax:
|
The declaration of a composite data type is made with the following syntax:
|
||||||
|
|
||||||
`typedef <sign> <scale> <base> $name`
|
`<sign> <scale> <base> = $name`
|
||||||
|
|
||||||
### Sign
|
### Sign
|
||||||
The `<sign>` is a keyword specifying whether to implement a sign bit or not. Possible values are:
|
The `<sign>` is a keyword specifying whether to implement a sign bit or not. Possible values are:
|
||||||
|
|
Loading…
Reference in New Issue