Category:ALGOL 68: Difference between revisions

→‎Coercion (casting): Reduced the width of the <div>
(Added TODO)
(→‎Coercion (casting): Reduced the width of the <div>)
Line 178:
<br>
Click "Expand" for more details.
<div class="mw-collapsible mw-collapsed" style="width:1200px880px; overflow:auto; background-color:parent;">
<div class="mw-collapsible-content" style="padding-left:2em;">
 
Line 204:
g
||Right hand side of:
* Identity-declarations, as "~" in: <langsyntaxhighlight algol68>REAL x = ~</langsyntaxhighlight>
* Initialisations, as "~" in: <langsyntaxhighlight algol68>REAL x := ~</langsyntaxhighlight>
Also:
* Actual-parameters of calls, as "~" in:<langsyntaxhighlight algol68>PROC: sin(~)</langsyntaxhighlight>
* Enclosed clauses of casts, as "~" in: <langsyntaxhighlight algol68>REAL(~)</langsyntaxhighlight>
* Units of routine-texts
* Statements yielding VOID
* All parts (but one) of a balanced clause
* One side of an identity relation, as "~" in: <langsyntaxhighlight algol68> ~ IS ~</langsyntaxhighlight>
|bgcolor=aaaaff rowspan=4 width="50px"| deproc- eduring
|bgcolor=aaeeaa rowspan=3 width="50px"| all '''soft''' then weak deref- erencing
Line 220:
|colspan=1 bgcolor=ffcccc|
Widening occurs if there is no loss of precision. For example: An INT will be coerced to a REAL, and a REAL will be coerced to a LONG REAL. But not vice-versa. Examples:
<langsyntaxhighlight algol68>INT to LONG INT
INT to REAL
REAL to COMPL
BITS to []BOOL
BYTES to STRING</langsyntaxhighlight>
A variable can also be coerced (rowed) to an array of length 1.
 
For example:
<langsyntaxhighlight algol68>INT to [1]INT
REAL to [1]REAL</langsyntaxhighlight> etc
|-
!F<br>
Line 236:
m
||
*Operands of formulas as "~" in:<langsyntaxhighlight algol68>OP: ~ * ~</langsyntaxhighlight>
*Parameters of transput calls
|colspan=3 bgcolor=ffcc99| Example:
<langsyntaxhighlight algol68>UNION(INT,REAL) var := 1</langsyntaxhighlight>
|-
!M<br>
Line 248:
* Trimscripts (yielding INT)
* Enquiries: e.g. as "~" in the following
<langsyntaxhighlight algol68>IF ~ THEN ... FI</langsyntaxhighlight> and
<langsyntaxhighlight algol68>FROM ~ BY ~ TO ~ WHILE ~ DO ... OD etc</langsyntaxhighlight>
* Primaries of calls (e.g. sin in sin(x))
|colspan=4 bgcolor=ffee99|Examples:
<langsyntaxhighlight algol68>REF REF BOOL to BOOL
REF REF REF INT to INT</langsyntaxhighlight>
|-
!W<br>
Line 260:
k
||
* Primaries of slices, as in "~" in: <langsyntaxhighlight algol68>~[1:99]</langsyntaxhighlight>
* Secondaries of selections, as "~" in: <langsyntaxhighlight algol68>value OF ~</langsyntaxhighlight>
|colspan=5 bgcolor=aaeeaa|Examples:
<langsyntaxhighlight algol68>REF BOOL to REF BOOL
REF REF INT to REF INT
REF REF REF REAL to REF REAL
REF REF REF REF STRUCT to REF STRUCT</langsyntaxhighlight>
|-
!S<br>
Line 272:
f<br>
t
|| The LHS of assignments, as "~" in: <langsyntaxhighlight algol68>~ := ...</langsyntaxhighlight>
|colspan=6 bgcolor=aaaaff| Example:
* deproceduring of: <langsyntaxhighlight algol68>PROC REAL random: e.g. random</langsyntaxhighlight>
|}
For more details about Primaries and Secondaries refer to [[Operator_precedence#ALGOL_68|Operator precedence]].
3,032

edits