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