Verified Commit 928dda9b authored by Camil Staps's avatar Camil Staps 🚀

Final documentation

parent 15f9ab77
.comp 920 010111011
.comp 920 01011101101
.code 0 0 0
.start _nostart_
.endinfo
......@@ -9,7 +9,7 @@
.export _channel_code
.export EMPTY INT BOOL CHAR REAL FILE _STRING_ _ARRAY_ ARRAY
.export EMPTY dINT BOOL CHAR REAL FILE _STRING_ _ARRAY_ ARRAY INT32 REAL32
.export _reserve _cycle_in_spine _hnf
.export _type_error _match_error selector_m_error index_error
.export _print_graph _eval_to_nf
......@@ -37,10 +37,10 @@
.desc GRAPH _hnf _hnf 0 0 ""
.desc _ARRAY_ _hnf _hnf 0 0 "_ARRAY_"
.desc _STRING_ _hnf _hnf 0 0 "_STRING_"
|.desc STRING _hnf _hnf 0 "STRING"
|.desc FILE _hnf _hnf 0 "FILE"
.desc REAL _hnf _hnf 0 0 "REAL"
.desc INT _hnf _hnf 0 0 "INT"
.desc dINT _hnf _hnf 0 0 "INT"
.desc REAL32 _hnf _hnf 0 0 "REAL32"
.desc INT32 _hnf _hnf 0 0 "INT32"
.desc BOOL _hnf _hnf 0 0 "BOOL"
.desc CHAR _hnf _hnf 0 0 "CHAR"
......@@ -105,12 +105,6 @@ l_Cons
.d 1 0
rtn
.o 3 0
ea_Cons
fill _Cons 2 _hnf 2
.d 1 0
rtn
.export _Conss n_Conss ea_Conss
.desc _Conss n_Conss l_Conss 2 0 "Cons!"
......@@ -127,6 +121,12 @@ l_Conss
.d 1 0
rtn
.o 3 0
ea_Cons
fill _Cons 2 _hnf 2
.d 1 0
rtn
.n 2 _Conss ea_Conss
.o 1 0
n_Conss
......@@ -196,14 +196,14 @@ ea_Conssts
.export _Consi _Consr _Consc _Consb _Consf
.record _Consi lia 1 1 "[#Int]"
.record _Consr lra 1 2 "[#Real]"
.record _Consr lra 1 1 "[#Real]"
.record _Consc lca 1 1 "[#Char]"
.record _Consb lba 1 1 "[#Bool]"
.record _Consf lfa 1 2 "[#File]"
.export _Consits _Consrts _Conscts _Consbts _Consfts
.record _Consits lia 1 1 "[#Int!]"
.record _Consrts lra 1 2 "[#Real!]"
.record _Consrts lra 1 1 "[#Real!]"
.record _Conscts lca 1 1 "[#Char!]"
.record _Consbts lba 1 1 "[#Bool!]"
.record _Consfts lfa 1 2 "[#File!]"
......@@ -992,28 +992,6 @@ _reserve
print "Run Time Warning: cycle in spine detected\n"
halt
.descexp e_system_dseq e_system_nseq e_system_lseq 2 0 "seq"
.a 0 e_system_easeq
.o 2 0
e_system_lseq
repl_args 1 1
.o 2 0
e_system_easeq
jsr_eval 0
pop_a 1
jmp_eval
.n 2 e_system_dseq _
.o 1 0
e_system_nseq
push_node _cycle_in_spine 2
jsr_eval 0
pop_a 1
jsr_eval 0
fill_a 0 1
pop_a 1
.d 1 0
rtn
|.n 0 EMPTY
|.o 1 0
|_reserve
......@@ -1216,11 +1194,9 @@ _print_ul_char
_print_ul_real
pop_b 1
push_b 2
push_b 2
update_b 2 4
update_b 1 3
updatepop_b 0 2
push_b 1
update_b 1 2
updatepop_b 0 1
print_real
......@@ -1420,7 +1396,7 @@ _print__array2
jmp_true _print_bool_array
push_b 0
eq_desc_b INT 0
eq_desc_b dINT 0
jmp_true _print_int_array
push_b 0
......@@ -1542,12 +1518,10 @@ _print_ar_char
_print_ar_real
pop_b 1
push_b 2
push_b 2
update_b 2 4
update_b 1 3
update_b 0 2
pop_b 2
push_b 1
update_b 1 2
update_b 0 1
pop_b 1
print_real
......@@ -1765,7 +1739,7 @@ _no_comma_3
create
fillR_b 0 0
pop_b 2
pop_b 1
print_symbol_sc 0
pop_a 1
......@@ -1894,12 +1868,10 @@ _print_r_char
_print_r_real
pop_b 1
push_b 2
push_b 2
update_b 2 4
update_b 1 3
update_b 0 2
pop_b 2
push_b 1
update_b 1 2
update_b 0 1
pop_b 1
print_real
......@@ -2122,26 +2094,26 @@ _eval_unboxed_list_lp1
_eval_ul_next_field
_eval_unboxed_list_lp2
eqC_b 'i' 0
jmp_true _eval_ul_int_char_or_bool
jmp_true _eval_ul_int_char_bool_or_real
eqC_b 'c' 0
jmp_true _eval_ul_int_char_or_bool
jmp_true _eval_ul_int_char_bool_or_real
eqC_b 'r' 0
jmp_true _eval_ul_real_or_file
jmp_true _eval_ul_int_char_bool_or_real
eqC_b 'b' 0
jmp_true _eval_ul_int_char_or_bool
jmp_true _eval_ul_int_char_bool_or_real
eqC_b 'f' 0
jmp_true _eval_ul_real_or_file
jmp_true _eval_ul_file
eqC_b 'a' 0
jmp_true _eval_ul_graph
pop_b 1
jmp _eval_rest_unboxed_list
_eval_ul_int_char_or_bool
_eval_ul_int_char_bool_or_real
pop_b 1
updatepop_b 0 1
jmp _eval_rest_unboxed_list
_eval_ul_real_or_file
_eval_ul_file
pop_b 1
updatepop_b 0 2
jmp _eval_rest_unboxed_list
......@@ -2202,7 +2174,7 @@ _eval__array2
jmp_true _eval_bool_array
push_b 0
eq_desc_b INT 0
eq_desc_b dINT 0
jmp_true _eval_int_array
push_b 0
......@@ -2380,6 +2352,7 @@ _eval_record_lp_
_eval_r_char
_eval_r_bool
_eval_r_integer
_eval_r_real
pop_b 1
update_b 0 1
pop_b 1
......@@ -2387,7 +2360,6 @@ _eval_r_integer
jmp _eval_record_lp
_eval_r_file
_eval_r_real
pop_b 1
update_b 0 2
pop_b 2
......
definition module StdEnum
/**
* This module must be imported if dotdot expressions are used.
* Then, the following constructs can be used:
*
* - `[from .. ]` -> `{{_from}} from`
* - `[from .. to]` -> `{{_from_to}} from to`
* - `[from, then .. ]` -> `{{_from_then}} from then`
* - `[from, then .. to]` -> `{{_from_then_to}} from then to`
*/
// ****************************************************************************************
// Concurrent Clean Standard Library Module Version 2.0
// Copyright 1998 University of Nijmegen
// ****************************************************************************************
/*
This module must be imported if dotdot expressions are used
[from .. ] -> _from from
[from .. to] -> _from_to from to
[from, then .. ] -> _from_then from then
[from, then .. to] -> _from_then_to from then to
*/
import _SystemEnum
......@@ -192,7 +192,7 @@ freadr f
= code inline {
.d 0 2 f
jsr readFR
.o 0 5 b r f
.o 0 4 b r f
}
freads::!*File !Int -> (!*{#Char},!*File)
......@@ -260,7 +260,7 @@ fwriter::!Real !*File -> *File
To a datafile fwriter writes eight bytes (a Clean Real). */
fwriter r f
= code inline {
.d 0 4 r f
.d 0 3 r f
jsr writeFR
.o 0 2 f
}
......@@ -358,10 +358,9 @@ sfreadr f
= code inline {
.d 0 2 f
jsr readSFR
.o 0 5 b r f
.o 0 4 b r f
}
sfreads::!File !Int -> (!*{#Char},!File)
sfreads f i
= code inline {
......@@ -453,14 +452,12 @@ instance <<< {#Char} where
instance <<< Real where
// (<<<) file r = fwriter r file
(<<<) file r = code inline {
push_b 3
push_b 3
update_b 3 5
update_b 2 4
update_b 1 3
update_b 0 2
pop_b 2
.d 0 4 r f
push_b 2
update_b 2 3
update_b 1 2
update_b 0 1
pop_b 1
.d 0 3 r f
jsr writeFR
.o 0 2 f
}
......
definition module StdFunc
/**
* A number of general functions and functions dealing with functions.
*/
// ****************************************************************************************
// Concurrent Clean Standard Library Module Version 2.0
// Copyright 1998 University of Nijmegen
......
......@@ -112,4 +112,4 @@ bitnot :: !Int -> Int
* @param The value if the platform is 32-bit
* @result Either of the parameters, depending on the platform
*/
IF_INT_64_OR_32 int64 int32 :== int32;
IF_INT_64_OR_32 int64 int32 :== int64;
This diff is collapsed.
definition module StdOrdList
/**
* Functions to work with lists of elements for which an ordering exists.
*/
// ****************************************************************************************
// Concurrent Clean Standard Library Module Version 2.0
// Copyright 1998 University of Nijmegen
......
definition module StdOverloaded
/**
* A number of common overloaded functions.
*/
// ****************************************************************************************
// Concurrent Clean Standard Library Module Version 2.0
// Copyright 1998 University of Nijmegen
// ****************************************************************************************
class (+) infixl 6 a :: !a !a -> a // Add arg1 to arg2
/**
* Add `arg1` to `arg2`.
*/
class (+) infixl 6 a :: !a !a -> a
/**
* Subtract `arg2` from `arg1`.
*/
class (-) infixl 6 a :: !a !a -> a
/**
* Zero (unit element for addition).
*/
class zero a :: a
/**
* Multiply `arg1` with `arg2`.
*/
class (*) infixl 7 a :: !a !a -> a
/**
* Divide `arg1` by `arg2`.
*/
class (/) infixl 7 a :: !a !a -> a
/**
* One (unit element for multiplication).
*/
class one a :: a
/**
* True if `arg1` is equal to `arg2`.
*/
class (==) infix 4 a :: !a !a -> Bool
/**
* True if `arg1` is less than `arg2`.
*/
class (<) infix 4 a :: !a !a -> Bool
/**
* True if `arg1` is an even number.
*/
class isEven a :: !a -> Bool;
/**
* True if `arg1` is an odd number.
*/
class isOdd a :: !a -> Bool;
/**
* Number of elements in `arg`.
* Used for list-like structures. It should have O(n) complexity.
*/
class length m :: !(m a) -> Int
/**
* Slice a part from `arg1`.
*/
class (%) infixl 9 a :: !a !(!Int,!Int) -> a
/**
* Append the arguments.
*/
class (+++) infixr 5 a :: !a !a -> a
/**
* `arg1` to the power of `arg2`.
*/
class (^) infixr 8 a :: !a !a -> a
/**
* Absolute value.
*/
class abs a :: !a -> a
/**
* The sign of a thing.
* @result `1` for a positive value; `-1` for a negative value; `0` for zero
*/
class sign a :: !a -> Int
/**
* Negate a thing.
*/
class ~ a :: !a -> a
class (-) infixl 6 a :: !a !a -> a // Subtract arg2 from arg1
class zero a :: a // Zero (unit element for addition)
/**
* `arg1` modulo `arg2`.
*/
class (mod) infix 7 a :: !a !a -> a
class (*) infixl 7 a :: !a !a -> a // Multiply arg1 with arg2
class (/) infixl 7 a :: !a !a -> a // Divide arg1 by arg2
class one a :: a // One (unit element for multiplication)
/**
* The remainder after division of `arg1 / arg2`.
*/
class (rem) infix 7 a :: !a !a -> a
class (==) infix 4 a :: !a !a -> Bool // True if arg1 is equal to arg2
class (<) infix 4 a :: !a !a -> Bool // True if arg1 is less than arg2
class isEven a :: !a -> Bool; // True if arg1 is an even number
class isOdd a :: !a -> Bool; // True if arg1 is an odd number
/**
* Greatest common divisor.
*/
class gcd a :: !a !a -> a
class length m :: !(m a) -> Int // Number of elements in arg
// used for list like structures (linear time)
/**
* Least common multiple.
*/
class lcm a :: !a !a -> a
class (%) infixl 9 a :: !a !(!Int,!Int) -> a // Slice a part from arg1
class (+++) infixr 5 a :: !a !a -> a // Append args
/**
* Convert into {{`Int`}}.
*/
class toInt a :: !a -> Int
class (^) infixr 8 a :: !a !a -> a // arg1 to the power of arg2
class abs a :: !a -> a // Absolute value
class sign a :: !a -> Int // 1 (pos value) -1 (neg value) 0 (if zero)
class ~ a :: !a -> a // -a1
/**
* Convert into {{`Char`}}.
*/
class toChar a :: !a -> Char
class (mod) infix 7 a :: !a !a -> a // arg1 modulo arg2
class (rem) infix 7 a :: !a !a -> a // remainder after division
class gcd a :: !a !a -> a // Greatest common divider
class lcm a :: !a !a -> a // Least common multiple
/**
* Convert into {{`Bool`}}.
*/
class toBool a :: !a -> Bool
class toInt a :: !a -> Int // Convert into Int
class toChar a :: !a -> Char // Convert into Char
class toBool a :: !a -> Bool // Convert into Bool
class toReal a :: !a -> Real // Convert into Real
class toString a :: !a -> {#Char} // Convert into String
/**
* Convert into {{`Real`}}.
*/
class toReal a :: !a -> Real
class fromInt a :: !Int -> a // Convert from Int
class fromChar a :: !Char -> a // Convert from Char
class fromBool a :: !Bool -> a // Convert from Bool
class fromReal a :: !Real -> a // Convert from Real
class fromString a :: !{#Char} -> a // Convert from String
/**
* Convert into {{`String`}}.
*/
class toString a :: !a -> {#Char}
/**
* Convert from {{`Int`}}.
*/
class fromInt a :: !Int -> a
/**
* Convert from {{`Char`}}.
*/
class fromChar a :: !Char -> a
/**
* Convert from {{`Bool`}}.
*/
class fromBool a :: !Bool -> a
/**
* Convert from {{`Real`}}.
*/
class fromReal a :: !Real -> a
/**
* Convert from {{`String`}}.
*/
class fromString a :: !{#Char} -> a
/**
* Logarithm base e.
*/
class ln a :: !a -> a
/**
* Logarithm base 10.
*/
class log10 a :: !a -> a
/**
* e to to the power of `arg`.
*/
class exp a :: !a -> a
/**
* Square root.
*/
class sqrt a :: !a -> a
class ln a :: !a -> a // Logarithm base e
class log10 a :: !a -> a // Logarithm base 10
class exp a :: !a -> a // e to to the power
class sqrt a :: !a -> a // Square root
// Trigonometrical Functions:
class sin a :: !a -> a // Sine
class cos a :: !a -> a // Cosine
class tan a :: !a -> a // Tangent
class asin a :: !a -> a // Arc Sine
class acos a :: !a -> a // Arc Cosine
class atan a :: !a -> a // Arc Tangent
class sinh a :: !a -> a // Hyperbolic Sine
class cosh a :: !a -> a // Hyperbolic Cosine
class tanh a :: !a -> a // Hyperbolic Tangent
class asinh a :: !a -> a // Arc Hyperbolic Sine
class acosh a :: !a -> a // Arc Hyperbolic Cosine
class atanh a :: !a -> a // Arc Hyperbolic Tangent
/**
* Sine.
*/
class sin a :: !a -> a
/**
* Cosine.
*/
class cos a :: !a -> a
/**
* Tangent.
*/
class tan a :: !a -> a
/**
* Arc Sine.
*/
class asin a :: !a -> a
/**
* Arc Cosine.
*/
class acos a :: !a -> a
/**
* Arc Tangent.
*/
class atan a :: !a -> a
/**
* Hyperbolic Sine.
*/
class sinh a :: !a -> a
/**
* Hyperbolic Cosine.
*/
class cosh a :: !a -> a
/**
* Hyperbolic Tangent.
*/
class tanh a :: !a -> a
/**
* Arc Hyperbolic Sine.
*/
class asinh a :: !a -> a
/**
* Arc Hyperbolic Cosine.
*/
class acosh a :: !a -> a
/**
* Arc Hyperbolic Tangent.
*/
class atanh a :: !a -> a
......@@ -236,14 +236,14 @@ where
fromReal :: !Real -> {#Char}
fromReal a
= code inline {
.d 0 2 r
.d 0 1 r
jsr RtoAC
.o 1 0
}
instance toReal {#Char}
where
toReal::!{#Char} -> Real
toReal :: !{#Char} -> Real
toReal s
| len == 0
= 0.0
......@@ -308,7 +308,7 @@ where
| posn == len
# e = eneg*eval-dn
| e>=0
= val * 10.0 ^ toReal e
= val * 10.0 ^ toReal e
| e>= -308
= val / 10.0 ^ toReal (~e)
= (val / 5.0 ^ toReal (~e)) / 2.0 ^ toReal (~e)
......
......@@ -49,10 +49,11 @@ instance toString Real
where
toString a
= code inline {
.d 0 2 r
.d 0 1 r
jsr RtoAC
.o 1 0
}
instance toString Bool
where
toString :: !Bool -> {#Char}
......
......@@ -2,6 +2,14 @@ definition module _SystemEnum
/**
* The underlying functions for dotdot expressions.
*
* This module must be imported if dotdot expressions are used.
* Then, the following constructs can be used:
*
* - `[from .. ]` -> `{{_from}} from`
* - `[from .. to]` -> `{{_from_to}} from to`
* - `[from, then .. ]` -> `{{_from_then}} from then`
* - `[from, then .. to]` -> `{{_from_then_to}} from then to`
*/
// ****************************************************************************************
......@@ -9,15 +17,6 @@ definition module _SystemEnum
// Copyright 1998 University of Nijmegen
// ****************************************************************************************
/*
This module must be imported if dotdot expressions are used
[from .. ] -> _from from
[from .. to] -> _from_to from to
[from, then .. ] -> _from_then from then
[from, then .. to] -> _from_then_to from then to
*/
from StdClass import class Enum (..), class IncDec (..), class Ord (..),<=,inc,dec
from StdBool import not
import StdInt,StdChar
......
......@@ -87,8 +87,8 @@ instance UList Int where {
instance UList Real where {
_cons_u a b = code {
fill_r _Consr 1 2 1 0 0
pop_b 2
fill_r _Consr 1 1 1 0 0
pop_b 1
pop_a 1
};
_decons_u a = code {
......@@ -183,8 +183,8 @@ instance UTSList Int where {
instance UTSList Real where {
_cons_uts a b = code {
fill_r _Consrts 1 2 1 0 0
pop_b 2
fill_r _Consrts 1 1 1 0 0
pop_b 1
pop_a 1
};
_decons_uts a = code {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment