There are 8 different data types, as follows (integer and character types are sometimes collectively called integral type.
@ (undefined, similar to the ``bottom''
of some algebras) is a special value. It has a unique (un-named)
data type. Some operators,
such as arithmetic operators
@ as their
operands, and usually
@ will be returned. Other operators which do not
@ operands will generate an error.
An integer can be specified using one of three formats.
Decimal Integer Constants
A decimal integer constant is a stream of digits with non-leading zero, for example:
|invalid (begins with non-digit)|
|invalid (begins with zero but is a valid octal)|
Octal Integer Constants
An octal integer constant is a stream of digits with a leading
zero. The digits
9 have octal values 10
and 11 respectively. For example:
|valid (= 302 decimal)|
|valid (= 020 octal = 16 decimal)|
|invalid (but is a valid decimal)|
|invalid (begins with non-digit)|
Hexadecimal Integer Constants
An hexadecimal integer constant is a stream of hexadecimal
digits starting with
0x (zero followed by the character
F have the hexadecimal values
10 to 15 respectively. Lowercase letters
are equivalent to their corresponding uppercase letters, for instance:
|valid (= 171 decimal)|
|valid (= 31 decimal)|
|invalid (begins with an alphabet letter)|
|invalid (missing x)|
A character constant is a character enclosed in single quotes,
The value of a character constant is the numerical value of the character
in the machine's character set, for example:
|valid (value is 65 for the ASCII character set)|
|invalid (more than one character)|
Certain special characters, such as the single quote
and the backslash
\, may be represented according
to the following table of escape sequences:
consists of the backslash followed by a stream of octal
digits which are taken to specify the value of the desired character.
If the character following a backslash is not one of those specified,
the backslash is ignored.
A floating point constant consists of an integer part, a decimal point,
a fraction part, and an exponent part; where an exponent part is an
E, and an optionally signed integer
exponent. The integer and fraction parts both consist of a sequence of
digits. Either the integer part or the fraction part (not both) may be
missing; either the decimal point or the
and the exponent (not both) may be missing.
Note that a floating point constant may not contain any embedded blanks or special characters.
Some floating point constants are:
1.23 .23 0.23 1. 1.0 1.2e10 1.23e-15
|comma not allowed|
|embedded space not allowed|
|decimal point or exponential part needed|
|integer part or fractional part needed|
|this is a floating point expression, not a constant|
A string constant is a character sequence enclosed in double quotes:
"this is a string"
The backslash convention for representing special characters can also be
used within a string. This makes it possible to represent the double quote
and the escape character backslash
\ within a string. It is
not possible for a string to contain the
\0 (NUL) character
since it is used to represent the end of string internally. Therefore,
"this is the end\0here we passed the end of string"
is equivalent to
"this is the end"
If s denotes a string expression, and i an index
(an integer expression)
denotes the ith character in the string.
An individual character of a string can be accessed randomly by giving
the index - an integer expression enclosed in
- after the string expression.
The first character is numbered 1 (not zero). For example, if
s = "abcdef";
|is the first character of s, i.e. 'a'.|
|is the ith character of s.|
It is illegal to index beyond the current number of characters in a string.
s is an error since
s has only six characters.
The suffix operator
# returns the current number of characters in the
string. In the last example,
s# is 6. For the empty string,
""# is 0.
A pointer is the address of an object in the memory space. The prefix
& gets the address of an object. For example,
iptr = & int_variable; cptr = & s; /* if s is a string, cptr points to the 5th char of s */
The prefix operator
* refers to the
object which the pointer is pointing to. For example,
i = * iptr ; /* i = int_variable; */ c = * cptr ; /* c = s; */
There are no pointer constants, and no pointer operations except the pointer equality checks.
The list is the only structured data type in Eden. Data items of different
types can be grouped to form a list using the
list formation operator
. Commas are used to separate the data. The whole list
is considered as a single data item. For example, the list
[ 100, 'a', "string", [1,2,3] ]
There are no list constants in the language. The characteristics of the list data type are:
- Different typed data can be stored in the same list. For instance,
L = [ 100, 'a', "string", [1,2,3] ];
Lholds four items: an integer (
100), a character (
'a'), a string (
"string") and a list (
- The individual items of a list can be accessed randomly by giving the
index (an integer expression quoted by
) after the list. The first item is numbered 1 (not zero). For example,
is the first item of
L, i.e. 100 (in the previous example).
- It is illegal to index beyond the current number of items of a list.
Lis an error since
Lhas only four items.
- The suffix operator # returns the current number of items in the list.
In the last example,
L#is 4, and
L#is 3. For the empty list,
- The infix operator
//returns the concatenated list of two lists; for example,
[1,2,3] // [5,6,7]produces
- List-related statements are:
- There are no list constants.