-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprims.ml
176 lines (159 loc) · 4.26 KB
/
prims.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
(* ferret prims
*
* copyright (c) 2012 by jeffrey massung
* all rights reserved
*
* prims.ml
*)
open Cell
(* leave ferret *)
let prim_bye st = exit 0
(* primitives *)
let prims =
[ ("bye",prim_bye)
(* kernel prims *)
; ("modules",Core.prim_modules)
; ("words",Core.prim_words)
; ("abort",Core.prim_abort)
; ("clear",Core.prim_clear)
; ("i",Core.prim_i)
; ("type",Core.prim_type)
; ("clock",Core.prim_clock)
(* stack shuffling prims *)
; ("dup",Core.prim_dup)
; ("drop",Core.prim_drop)
; ("swap",Core.prim_swap)
; ("over",Core.prim_over)
; ("nip",Core.prim_nip)
; ("rot",Core.prim_rot)
; ("-rot",Core.prim_rrot)
; ("2dup",Core.prim_2dup)
; ("2drop",Core.prim_2drop)
; ("2swap",Core.prim_2swap)
; ("2over",Core.prim_2over)
; ("2nip",Core.prim_2nip)
; ("push",Core.prim_push)
; ("pop",Core.prim_pop)
(* block closure prims *)
; ("apply",Core.prim_apply)
; ("try",Core.prim_try)
(* record functions *)
; ("make-tuple",Core.prim_make_tuple)
; ("element",Core.prim_at)
; ("element!",Core.prim_set)
(* pair prims *)
; ("pair",Core.prim_pair)
; ("unpair",Core.prim_unpair)
; ("fst",Core.prim_fst)
; ("snd",Core.prim_snd)
; ("fst!",Core.prim_set_fst)
; ("snd!",Core.prim_set_snd)
(* list prims *)
; (",",Core.prim_cons)
; ("uncons",Core.prim_uncons)
; ("null",Core.prim_null)
; ("len",Core.prim_len)
; ("rev",Core.prim_rev)
; ("hd",Core.prim_hd)
; ("tl",Core.prim_tl)
; ("foldl",Core.prim_foldl)
; ("foldr",Core.prim_foldr)
; ("merge",Core.prim_merge)
; ("sort",Core.prim_sort)
; ("explode",Core.prim_explode)
; ("implode",Core.prim_implode)
(* process prims *)
; ("spawn",Core.prim_spawn)
; ("self",Core.prim_self)
; ("kill",Core.prim_kill)
; ("status",Core.prim_status)
; ("join",Core.prim_join)
; ("sleep",Core.prim_sleep)
; ("yield",Core.prim_yield)
; ("!",Core.prim_send)
; ("@",Core.prim_receive)
(* math prims *)
; ("=",Core.prim_eq)
; ("<>",Core.prim_ne)
; ("<",Core.prim_lt)
; (">",Core.prim_gt)
; ("<=",Core.prim_le)
; (">=",Core.prim_ge)
; ("+",Core.prim_plus)
; ("-",Core.prim_minus)
; ("*",Core.prim_times)
; ("/",Core.prim_divide)
; ("//",Core.prim_div)
; ("**",Core.prim_pow)
; ("mod",Core.prim_mod)
; ("abs",Core.prim_abs)
; ("neg",Core.prim_neg)
; ("1+",Core.prim_inc)
; ("1-",Core.prim_dec)
; ("2*",Core.prim_lshift)
; ("2/",Core.prim_rshift)
; ("~not",Core.prim_lnot)
; ("~and",Core.prim_land)
; ("~or",Core.prim_lor)
; ("~xor",Core.prim_lxor)
; ("lsl",Core.prim_lsl)
; ("lsr",Core.prim_lsr)
; ("asr",Core.prim_asr)
; ("sqrt",Core.prim_sqrt)
; ("exp",Core.prim_exp)
; ("log",Core.prim_log)
; ("log10",Core.prim_log10)
; ("sin",Core.prim_sin)
; ("cos",Core.prim_cos)
; ("tan",Core.prim_tan)
; ("asin",Core.prim_asin)
; ("acos",Core.prim_acos)
; ("atan",Core.prim_atan)
; ("sinh",Core.prim_sinh)
; ("cosh",Core.prim_cosh)
; ("tanh",Core.prim_tanh)
; ("ceil",Core.prim_ceil)
; ("floor",Core.prim_floor)
; ("truncate",Core.prim_truncate)
; ("float",Core.prim_float)
; ("0=",Core.prim_zero true)
; ("0<>",Core.prim_zero false)
; ("0<",Core.prim_negative)
; ("0>",Core.prim_positive)
; ("epsilon",Core.prim_epsilon)
; ("max-int",Core.prim_max_int)
; ("min-int",Core.prim_min_int)
; ("max-float",Core.prim_max_float)
; ("min-float",Core.prim_min_float)
; ("random",Core.prim_random)
(* boolean operator prims *)
; ("not",Core.prim_not)
; ("and",Core.prim_and)
; ("or",Core.prim_or)
(* string prims *)
; ("form",Core.prim_form)
; ("&",Core.prim_strcat)
; ("&&",Core.prim_strcat_space)
; ("upcase",Core.prim_uppercase)
; ("downcase",Core.prim_lowercase)
; ("/string",Core.prim_strip)
; ("c@",Core.prim_char)
; ("c!",Core.prim_set_char)
(* re prims *)
; ("match",Core.prim_match)
; ("scan",Core.prim_scan)
; ("rscan",Core.prim_rscan)
(* output prims *)
; (".s",Core.prim_stack)
; (".cs",Core.prim_control_stack)
; ("putc",Core.prim_princ)
; ("puts",Core.prim_print print_endline)
; ("print",Core.prim_print print_string)
; ("prerr",Core.prim_print prerr_endline)
(* io prims *)
; ("file",Core.prim_file)
; ("url",Core.prim_url)
; ("input",Core.prim_input)
; ("read",Core.prim_read)
; ("load",Core.prim_load)
]