ARRAY 10, 20 OF REAL
+ ARRAY 10, 20 OF Real
- A record type is a structure consisting of a fixed number of elements of possibly different types. The record type declaration specifies for each element, called field, its type and an identifier which denotes the field. The scope of these field identifiers is the record definition itself, but they are also visible within field designators (see 8.1) referring to elements of record variables.
+ A record type is a structure consisting of a fixed number of elements of possibly different types. The record type declaration specifies for each element, called field, its type and an identifier which denotes the field. The scope of these field identifiers is the record definition itself, but they are also visible within field designators (see 8.1) referring to elements of record variables.
RecordType = RECORD ["(" BaseType ")"] [FieldListSequence] END.
BaseType = qualident.
@@ -522,9 +518,9 @@ END
RECORD
- name, firstname: ARRAY 32 OF CHAR;
+ name, firstname: ARRAY 32 OF Char;
age: Int;
- salary: REAL
+ salary: Real
END
@@ -537,11 +533,11 @@ END
If a type P is defined as POINTER TO T, the identifier T can be declared textually following the declaration of P, but [if so] it must lie within the same scope.
- If p is a variable of type P = POINTER TO T, then a call of the predefined procedure NEW(p) has the following effect (see 10.2): A variable of type T is allocated in free storage, and a pointer to it is assigned to p. This pointer p is of type P and the referenced variable p^ is of type T. Failure of allocation results in p obtaining the value NIL. Any pointer variable may be assigned the value NIL, which points to no variable at all.
+ If p is a variable of type P = POINTER TO T, then a call of the predefined procedure NEW(p) has the following effect (see 10.2): A variable of type T is allocated in free storage, and a pointer to it is assigned to p. This pointer p is of type P and the referenced variable p^ is of type T. Failure of allocation results in p obtaining the value NIL. Any pointer variable may be assigned the value NIL, which points to no variable at all.
- Variables of a procedure type T have a procedure (or NIL) as value. If a procedure P is assigned to a procedure variable of type T, the (types of the) formal parameters of P must be the same as those indicated in the formal parameters of T. The same holds for the result type in the case of a function procedure (see 10.1). P must not be declared local to another procedure, and neither can it be a standard procedure.
+ Variables of a procedure type T have a procedure (or NIL) as value. If a procedure P is assigned to a procedure variable of type T, the (types of the) formal parameters of P must be the same as those indicated in the formal parameters of T. The same holds for the result type in the case of a function procedure (see 10.1). P must not be declared local to another procedure, and neither can it be a standard procedure.
ProcedureType = PROCEDURE [FormalParameters].
@@ -553,27 +549,25 @@ END
VariableDeclaration = IdentList ":" type.
- Variables whose identifiers appear in the same list are all of the same type. Examples of variable declarations (refer to examples in Ch. 6):
+ Variables whose identifiers appear in the same list are all of the same type. Examples of variable declarations (refer to examples in Ch. 6):
i, j, k: Int
- x, y: REAL
+ x, y: Real
- p, q: BOOLEAN
-
- s: SET
+ p, q: Bool
f: Function
- a: ARRAY 100 OF REAL
+ a: ARRAY 100 OF Real
w: ARRAY 16 OF
- RECORD ch: CHAR;
+ RECORD ch: Char;
count: Int
END
@@ -587,7 +581,7 @@ END
- With the exception of sets and literal constants, i.e. numbers and strings, operands are denoted by designators. A designator consists of an identifier referring to the constant, variable, or procedure to be designated. This identifier may possibly be qualified by module identifiers (see Ch. 4 and 11), and it may be followed by selectors, if the designated object is an element of a structure.
+ With the exception of sets and literal constants, i.e. numbers and strings, operands are denoted by designators. A designator consists of an identifier referring to the constant, variable, or procedure to be designated. This identifier may possibly be qualified by module identifiers (see Ch. 4 and 11), and it may be followed by selectors, if the designated object is an element of a structure.
If A designates an array, then A[E] denotes that element of A whose index is the current value of the expression E. The type of E must be of type Int. A designator of the form A[E1, E2, ... , En] stands for A[E1][E2] ... [En]. If p designates a pointer variable, p^ denotes the variable which is referenced by p. If r designates a record, then r.f denotes the field f of r. If p designates a pointer, p.f denotes the field f of the record p^, i.e. the dot implies dereferencing and p.f stands for p^.f.
@@ -603,9 +597,9 @@ selector = "." ident | "[" ExpList "]" | "^" | "(" qualident ")".
ExpList = expression {"," expression}.
- If the designated object is a variable, then the designator refers to the variable's current value. If the object is a procedure, a designator without parameter list refers to that procedure. If it is followed by a (possibly empty) parameter list, the designator implies an activation of the procedure and stands for the value resulting from its execution. The (types of the) actual parameters must correspond to the formal parameters as specified in the procedure's declaration (see Ch. 10).
+ If the designated object is a variable, then the designator refers to the variable's current value. If the object is a procedure, a designator without parameter list refers to that procedure. If it is followed by a (possibly empty) parameter list, the designator implies an activation of the procedure and stands for the value resulting from its execution. The (types of the) actual parameters must correspond to the formal parameters as specified in the procedure's declaration (see Ch. 10).
- Examples of designators (see examples in Ch. 7):
+ Examples of designators (see examples in Ch. 7):
@@ -615,11 +609,11 @@ ExpList = expression {"," expression}.
a[i] |
- (REAL) |
+ (Real) |
w[3].ch |
- (CHAR) |
+ (Char) |
t.key |
@@ -673,7 +667,7 @@ ActualParameters = "(" [ExpList] ")" .
- These operators apply to BOOLEAN operands and yield a BOOLEAN result.
+ These operators apply to Bool operands and yield a Bool result.
@@ -776,7 +770,7 @@ ActualParameters = "(" [ExpList] ")" .
- Relations are Boolean. The ordering relations <, <=, >, >= apply to the numeric types, CHAR, and character arrays. The relations = and # also apply to the types BOOLEAN, SET, and to pointer and procedure types.
+ Relations are Boolean. The ordering relations <, <=, >, >= apply to the numeric types, Char, and character arrays. The relations = and # also apply to the types Bool, SET, and to pointer and procedure types.
v IS T stands for âv is of type Tâ and is called a type test. It is applicable, if
@@ -787,7 +781,7 @@ ActualParameters = "(" [ExpList] ")" .
Assuming, for instance, that T is an extension of T0 and that v is a designator declared of type T0, then the test v IS T determines whether the actually designated variable is (not only a T0, but also) a T. The value of NIL IS T is undefined.
- Examples of expressions (refer to examples in Ch. 7):
+ Examples of expressions (refer to examples in Ch. 7):
@@ -801,7 +795,7 @@ ActualParameters = "(" [ExpList] ")" .
~p OR q |
- (BOOLEAN) |
+ (Bool) |
(i+j) * (i-j) |
@@ -809,19 +803,19 @@ ActualParameters = "(" [ExpList] ")" .
a[i+j] * a[i-j] |
- (REAL) |
+ (Real) |
(0<=i) & (i<100) |
- (BOOLEAN) |
+ (Bool) |
t.key = 0 |
- (BOOLEAN) |
+ (Bool) |
t IS CenterNode |
- (BOOLEAN) |
+ (Bool) |
@@ -847,12 +841,12 @@ ActualParameters = "(" [ExpList] ")" .
- The constant NIL can be assigned to variables of any pointer or procedure type.
- - Strings can be assigned to any array of characters, provided the number of characters in the string is less than that of the array. (A null character is appended). Single-character strings can also be assigned to variables of type CHAR.
+ - Strings can be assigned to any array of characters, provided the number of characters in the string is less than that of the array. (A null character is appended). Single-character strings can also be assigned to variables of type Char.
- In the case of records, the type of the source must be an extension of the type of the destination.
- An open array may be assigned to an array of equal base type.
- Examples of assignments (see examples in Ch. 7):
+ Examples of assignments (see examples in Ch. 7):
i := 0
@@ -860,7 +854,7 @@ ActualParameters = "(" [ExpList] ")" .
p := i = j
- x := FLT(i + 1)
+ x := AsFloat(i + 1)
k := (i + j) DIV 2
@@ -869,9 +863,6 @@ ActualParameters = "(" [ExpList] ")" .
f := log2
- s := {2, 3, 5, 7, 11, 13}
-
-
a[i] := (x+y) * (x-y)
@@ -883,9 +874,9 @@ ActualParameters = "(" [ExpList] ")" .
- A procedure call serves to activate a procedure. The procedure call may contain a list of actual parameters which are substituted in place of their corresponding formal parameters defined in the procedure declaration (see Ch. 10). The correspondence is established by the positions of the parameters in the lists of actual and formal parameters respectively. There exist two kinds of parameters: variable and value parameters.
+ A procedure call serves to activate a procedure. The procedure call may contain a list of actual parameters which are substituted in place of their corresponding formal parameters defined in the procedure declaration (see Ch. 10). The correspondence is established by the positions of the parameters in the lists of actual and formal parameters respectively. There exist two kinds of parameters: variable and value parameters.
- In the case of variable parameters, the actual parameter must be a designator denoting a variable. If it designates an element of a structured variable, the selector is evaluated when the formal/actual parameter substitution takes place, i.e. before the execution of the procedure. If the parameter is a value parameter, the corresponding actual parameter must be an expression. This expression is evaluated prior to the procedure activation, and the resulting value is assigned to the formal parameter which now constitutes a local variable (see also 10.1.).
+ In the case of variable parameters, the actual parameter must be a designator denoting a variable. If it designates an element of a structured variable, the selector is evaluated when the formal/actual parameter substitution takes place, i.e. before the execution of the procedure. If the parameter is a value parameter, the corresponding actual parameter must be an expression. This expression is evaluated prior to the procedure activation, and the resulting value is assigned to the formal parameter which now constitutes a local variable (see also 10.1.).
ProcedureCall = designator [ActualParameters].
@@ -896,7 +887,7 @@ ActualParameters = "(" [ExpList] ")" .