@grain/stdlib 0.5.12 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/CHANGELOG.md +200 -0
  2. package/LICENSE +1 -1
  3. package/README.md +25 -2
  4. package/array.gr +1512 -199
  5. package/array.md +2032 -94
  6. package/bigint.gr +239 -140
  7. package/bigint.md +450 -106
  8. package/buffer.gr +595 -102
  9. package/buffer.md +903 -145
  10. package/bytes.gr +401 -110
  11. package/bytes.md +551 -63
  12. package/char.gr +228 -49
  13. package/char.md +373 -7
  14. package/exception.gr +26 -12
  15. package/exception.md +29 -5
  16. package/float32.gr +130 -109
  17. package/float32.md +185 -57
  18. package/float64.gr +112 -99
  19. package/float64.md +185 -57
  20. package/hash.gr +47 -37
  21. package/hash.md +21 -3
  22. package/int16.gr +430 -0
  23. package/int16.md +618 -0
  24. package/int32.gr +200 -269
  25. package/int32.md +254 -289
  26. package/int64.gr +142 -225
  27. package/int64.md +254 -289
  28. package/int8.gr +511 -0
  29. package/int8.md +786 -0
  30. package/json.gr +2084 -0
  31. package/json.md +608 -0
  32. package/list.gr +120 -68
  33. package/list.md +125 -80
  34. package/map.gr +560 -57
  35. package/map.md +672 -56
  36. package/marshal.gr +239 -227
  37. package/marshal.md +36 -4
  38. package/number.gr +626 -676
  39. package/number.md +738 -153
  40. package/option.gr +33 -35
  41. package/option.md +58 -42
  42. package/package.json +2 -2
  43. package/path.gr +148 -187
  44. package/path.md +47 -96
  45. package/pervasives.gr +75 -416
  46. package/pervasives.md +85 -180
  47. package/priorityqueue.gr +433 -74
  48. package/priorityqueue.md +422 -54
  49. package/queue.gr +362 -80
  50. package/queue.md +433 -38
  51. package/random.gr +67 -75
  52. package/random.md +68 -40
  53. package/range.gr +135 -63
  54. package/range.md +198 -43
  55. package/rational.gr +284 -0
  56. package/rational.md +545 -0
  57. package/regex.gr +933 -1066
  58. package/regex.md +59 -60
  59. package/result.gr +23 -25
  60. package/result.md +54 -39
  61. package/runtime/atof/common.gr +78 -82
  62. package/runtime/atof/common.md +22 -10
  63. package/runtime/atof/decimal.gr +102 -127
  64. package/runtime/atof/decimal.md +28 -7
  65. package/runtime/atof/lemire.gr +56 -71
  66. package/runtime/atof/lemire.md +9 -1
  67. package/runtime/atof/parse.gr +83 -110
  68. package/runtime/atof/parse.md +12 -2
  69. package/runtime/atof/slow.gr +28 -35
  70. package/runtime/atof/slow.md +9 -1
  71. package/runtime/atof/table.gr +19 -18
  72. package/runtime/atof/table.md +10 -2
  73. package/runtime/atoi/parse.gr +153 -136
  74. package/runtime/atoi/parse.md +50 -1
  75. package/runtime/bigint.gr +410 -517
  76. package/runtime/bigint.md +71 -57
  77. package/runtime/compare.gr +176 -85
  78. package/runtime/compare.md +31 -1
  79. package/runtime/dataStructures.gr +144 -32
  80. package/runtime/dataStructures.md +267 -31
  81. package/runtime/debugPrint.gr +34 -15
  82. package/runtime/debugPrint.md +37 -5
  83. package/runtime/equal.gr +53 -52
  84. package/runtime/equal.md +30 -1
  85. package/runtime/exception.gr +38 -47
  86. package/runtime/exception.md +10 -8
  87. package/runtime/gc.gr +23 -152
  88. package/runtime/gc.md +13 -17
  89. package/runtime/malloc.gr +31 -31
  90. package/runtime/malloc.md +11 -3
  91. package/runtime/numberUtils.gr +191 -172
  92. package/runtime/numberUtils.md +17 -9
  93. package/runtime/numbers.gr +1695 -1021
  94. package/runtime/numbers.md +1098 -134
  95. package/runtime/string.gr +540 -242
  96. package/runtime/string.md +76 -6
  97. package/runtime/unsafe/constants.gr +30 -13
  98. package/runtime/unsafe/constants.md +80 -0
  99. package/runtime/unsafe/conv.gr +55 -28
  100. package/runtime/unsafe/conv.md +41 -9
  101. package/runtime/unsafe/memory.gr +10 -30
  102. package/runtime/unsafe/memory.md +15 -19
  103. package/runtime/unsafe/tags.gr +37 -21
  104. package/runtime/unsafe/tags.md +88 -8
  105. package/runtime/unsafe/wasmf32.gr +30 -36
  106. package/runtime/unsafe/wasmf32.md +64 -56
  107. package/runtime/unsafe/wasmf64.gr +30 -36
  108. package/runtime/unsafe/wasmf64.md +64 -56
  109. package/runtime/unsafe/wasmi32.gr +49 -66
  110. package/runtime/unsafe/wasmi32.md +102 -94
  111. package/runtime/unsafe/wasmi64.gr +52 -79
  112. package/runtime/unsafe/wasmi64.md +108 -100
  113. package/runtime/utils/printing.gr +13 -15
  114. package/runtime/utils/printing.md +11 -3
  115. package/runtime/wasi.gr +294 -295
  116. package/runtime/wasi.md +62 -42
  117. package/set.gr +574 -64
  118. package/set.md +634 -54
  119. package/stack.gr +181 -64
  120. package/stack.md +271 -42
  121. package/string.gr +453 -533
  122. package/string.md +241 -151
  123. package/uint16.gr +369 -0
  124. package/uint16.md +585 -0
  125. package/uint32.gr +470 -0
  126. package/uint32.md +737 -0
  127. package/uint64.gr +471 -0
  128. package/uint64.md +737 -0
  129. package/uint8.gr +369 -0
  130. package/uint8.md +585 -0
  131. package/uri.gr +1093 -0
  132. package/uri.md +477 -0
  133. package/{sys → wasi}/file.gr +914 -500
  134. package/{sys → wasi}/file.md +454 -50
  135. package/wasi/process.gr +292 -0
  136. package/{sys → wasi}/process.md +164 -6
  137. package/wasi/random.gr +77 -0
  138. package/wasi/random.md +80 -0
  139. package/{sys → wasi}/time.gr +15 -22
  140. package/{sys → wasi}/time.md +5 -5
  141. package/immutablearray.gr +0 -929
  142. package/immutablearray.md +0 -1038
  143. package/immutablemap.gr +0 -493
  144. package/immutablemap.md +0 -479
  145. package/immutablepriorityqueue.gr +0 -360
  146. package/immutablepriorityqueue.md +0 -291
  147. package/immutableset.gr +0 -498
  148. package/immutableset.md +0 -449
  149. package/runtime/debug.gr +0 -2
  150. package/runtime/debug.md +0 -6
  151. package/runtime/unsafe/errors.gr +0 -36
  152. package/runtime/unsafe/errors.md +0 -204
  153. package/sys/process.gr +0 -254
  154. package/sys/random.gr +0 -79
  155. package/sys/random.md +0 -66
@@ -1,13 +1,21 @@
1
+ ---
2
+ title: Tags
3
+ ---
4
+
5
+ ## Values
6
+
7
+ Functions and constants included in the Tags module.
8
+
1
9
  ### Tags.**_GRAIN_NUMBER_TAG_TYPE**
2
10
 
3
11
  ```grain
4
12
  _GRAIN_NUMBER_TAG_TYPE : WasmI32
5
13
  ```
6
14
 
7
- ### Tags.**_GRAIN_CHAR_TAG_TYPE**
15
+ ### Tags.**_GRAIN_SHORTVAL_TAG_TYPE**
8
16
 
9
17
  ```grain
10
- _GRAIN_CHAR_TAG_TYPE : WasmI32
18
+ _GRAIN_SHORTVAL_TAG_TYPE : WasmI32
11
19
  ```
12
20
 
13
21
  ### Tags.**_GRAIN_CONST_TAG_TYPE**
@@ -34,6 +42,66 @@ _GRAIN_NUMBER_TAG_MASK : WasmI32
34
42
  _GRAIN_GENERIC_TAG_MASK : WasmI32
35
43
  ```
36
44
 
45
+ ### Tags.**_GRAIN_CHAR_SHORTVAL_TAG**
46
+
47
+ ```grain
48
+ _GRAIN_CHAR_SHORTVAL_TAG : WasmI32
49
+ ```
50
+
51
+ ### Tags.**_GRAIN_INT8_SHORTVAL_TAG**
52
+
53
+ ```grain
54
+ _GRAIN_INT8_SHORTVAL_TAG : WasmI32
55
+ ```
56
+
57
+ ### Tags.**_GRAIN_INT16_SHORTVAL_TAG**
58
+
59
+ ```grain
60
+ _GRAIN_INT16_SHORTVAL_TAG : WasmI32
61
+ ```
62
+
63
+ ### Tags.**_GRAIN_UINT8_SHORTVAL_TAG**
64
+
65
+ ```grain
66
+ _GRAIN_UINT8_SHORTVAL_TAG : WasmI32
67
+ ```
68
+
69
+ ### Tags.**_GRAIN_UINT16_SHORTVAL_TAG**
70
+
71
+ ```grain
72
+ _GRAIN_UINT16_SHORTVAL_TAG : WasmI32
73
+ ```
74
+
75
+ ### Tags.**_GRAIN_GENERIC_SHORTVAL_TAG_MASK**
76
+
77
+ ```grain
78
+ _GRAIN_GENERIC_SHORTVAL_TAG_MASK : WasmI32
79
+ ```
80
+
81
+ ### Tags.**_GRAIN_INT8_TAG_MASK**
82
+
83
+ ```grain
84
+ _GRAIN_INT8_TAG_MASK : WasmI32
85
+ ```
86
+
87
+ ### Tags.**_GRAIN_INT16_TAG_MASK**
88
+
89
+ ```grain
90
+ _GRAIN_INT16_TAG_MASK : WasmI32
91
+ ```
92
+
93
+ ### Tags.**_GRAIN_UINT8_TAG_MASK**
94
+
95
+ ```grain
96
+ _GRAIN_UINT8_TAG_MASK : WasmI32
97
+ ```
98
+
99
+ ### Tags.**_GRAIN_UINT16_TAG_MASK**
100
+
101
+ ```grain
102
+ _GRAIN_UINT16_TAG_MASK : WasmI32
103
+ ```
104
+
37
105
  ### Tags.**_GRAIN_STRING_HEAP_TAG**
38
106
 
39
107
  ```grain
@@ -82,22 +150,34 @@ _GRAIN_TUPLE_HEAP_TAG : WasmI32
82
150
  _GRAIN_BYTES_HEAP_TAG : WasmI32
83
151
  ```
84
152
 
85
- ### Tags.**_GRAIN_FLOAT32_BOXED_NUM_TAG**
153
+ ### Tags.**_GRAIN_INT32_HEAP_TAG**
86
154
 
87
155
  ```grain
88
- _GRAIN_FLOAT32_BOXED_NUM_TAG : WasmI32
156
+ _GRAIN_INT32_HEAP_TAG : WasmI32
89
157
  ```
90
158
 
91
- ### Tags.**_GRAIN_FLOAT64_BOXED_NUM_TAG**
159
+ ### Tags.**_GRAIN_FLOAT32_HEAP_TAG**
92
160
 
93
161
  ```grain
94
- _GRAIN_FLOAT64_BOXED_NUM_TAG : WasmI32
162
+ _GRAIN_FLOAT32_HEAP_TAG : WasmI32
163
+ ```
164
+
165
+ ### Tags.**_GRAIN_UINT32_HEAP_TAG**
166
+
167
+ ```grain
168
+ _GRAIN_UINT32_HEAP_TAG : WasmI32
95
169
  ```
96
170
 
97
- ### Tags.**_GRAIN_INT32_BOXED_NUM_TAG**
171
+ ### Tags.**_GRAIN_UINT64_HEAP_TAG**
98
172
 
99
173
  ```grain
100
- _GRAIN_INT32_BOXED_NUM_TAG : WasmI32
174
+ _GRAIN_UINT64_HEAP_TAG : WasmI32
175
+ ```
176
+
177
+ ### Tags.**_GRAIN_FLOAT64_BOXED_NUM_TAG**
178
+
179
+ ```grain
180
+ _GRAIN_FLOAT64_BOXED_NUM_TAG : WasmI32
101
181
  ```
102
182
 
103
183
  ### Tags.**_GRAIN_INT64_BOXED_NUM_TAG**
@@ -1,44 +1,38 @@
1
- /* grainc-flags --compilation-mode=runtime */
1
+ @runtimeMode
2
+ module WasmF32
2
3
 
3
4
  // WebAssembly Memory Instructions
4
- export primitive load: (WasmI32, WasmI32) -> WasmF32 = "@wasm.load_float32"
5
- export primitive store: (
6
- WasmI32,
7
- WasmF32,
8
- WasmI32,
9
- ) -> Void = "@wasm.store_float32"
5
+ provide primitive load = "@wasm.load_float32"
6
+ provide primitive store = "@wasm.store_float32"
10
7
 
11
8
  // WebAssembly Unary Instructions
12
- export primitive neg: WasmF32 -> WasmF32 = "@wasm.neg_float32"
13
- export primitive abs: WasmF32 -> WasmF32 = "@wasm.abs_float32"
14
- export primitive ceil: WasmF32 -> WasmF32 = "@wasm.ceil_float32"
15
- export primitive floor: WasmF32 -> WasmF32 = "@wasm.floor_float32"
16
- export primitive trunc: WasmF32 -> WasmF32 = "@wasm.trunc_float32"
17
- export primitive nearest: WasmF32 -> WasmF32 = "@wasm.nearest_float32"
18
- export primitive sqrt: WasmF32 -> WasmF32 = "@wasm.sqrt_float32"
9
+ provide primitive neg = "@wasm.neg_float32"
10
+ provide primitive abs = "@wasm.abs_float32"
11
+ provide primitive ceil = "@wasm.ceil_float32"
12
+ provide primitive floor = "@wasm.floor_float32"
13
+ provide primitive trunc = "@wasm.trunc_float32"
14
+ provide primitive nearest = "@wasm.nearest_float32"
15
+ provide primitive sqrt = "@wasm.sqrt_float32"
19
16
 
20
17
  // WebAssembly Binary Instructions
21
- export primitive add: (WasmF32, WasmF32) -> WasmF32 = "@wasm.add_float32"
22
- export primitive sub: (WasmF32, WasmF32) -> WasmF32 = "@wasm.sub_float32"
23
- export primitive mul: (WasmF32, WasmF32) -> WasmF32 = "@wasm.mul_float32"
24
- export primitive div: (WasmF32, WasmF32) -> WasmF32 = "@wasm.div_float32"
25
- export primitive copySign: (
26
- WasmF32,
27
- WasmF32,
28
- ) -> WasmF32 = "@wasm.copy_sign_float32"
29
- export primitive min: (WasmF32, WasmF32) -> WasmF32 = "@wasm.min_float32"
30
- export primitive max: (WasmF32, WasmF32) -> WasmF32 = "@wasm.max_float32"
31
- export primitive eq: (WasmF32, WasmF32) -> Bool = "@wasm.eq_float32"
32
- export primitive ne: (WasmF32, WasmF32) -> Bool = "@wasm.ne_float32"
33
- export primitive lt: (WasmF32, WasmF32) -> Bool = "@wasm.lt_float32"
34
- export primitive le: (WasmF32, WasmF32) -> Bool = "@wasm.le_float32"
35
- export primitive gt: (WasmF32, WasmF32) -> Bool = "@wasm.gt_float32"
36
- export primitive ge: (WasmF32, WasmF32) -> Bool = "@wasm.ge_float32"
18
+ provide primitive (+) = "@wasm.add_float32"
19
+ provide primitive (-) = "@wasm.sub_float32"
20
+ provide primitive (*) = "@wasm.mul_float32"
21
+ provide primitive (/) = "@wasm.div_float32"
22
+ provide primitive copySign = "@wasm.copy_sign_float32"
23
+ provide primitive min = "@wasm.min_float32"
24
+ provide primitive max = "@wasm.max_float32"
25
+ provide primitive (==) = "@wasm.eq_float32"
26
+ provide primitive (!=) = "@wasm.ne_float32"
27
+ provide primitive (<) = "@wasm.lt_float32"
28
+ provide primitive (<=) = "@wasm.le_float32"
29
+ provide primitive (>) = "@wasm.gt_float32"
30
+ provide primitive (>=) = "@wasm.ge_float32"
37
31
 
38
32
  // WebAssembly Conversion instructions
39
- export primitive reinterpretI32: WasmI32 -> WasmF32 = "@wasm.reinterpret_int32"
40
- export primitive convertI32S: WasmI32 -> WasmF32 = "@wasm.convert_s_int32_to_float32"
41
- export primitive convertI32U: WasmI32 -> WasmF32 = "@wasm.convert_u_int32_to_float32"
42
- export primitive convertI64S: WasmI64 -> WasmF32 = "@wasm.convert_s_int64_to_float32"
43
- export primitive convertI64U: WasmI64 -> WasmF32 = "@wasm.convert_u_int64_to_float32"
44
- export primitive demoteF64: WasmF64 -> WasmF32 = "@wasm.demote_float64"
33
+ provide primitive reinterpretI32 = "@wasm.reinterpret_int32"
34
+ provide primitive convertI32S = "@wasm.convert_s_int32_to_float32"
35
+ provide primitive convertI32U = "@wasm.convert_u_int32_to_float32"
36
+ provide primitive convertI64S = "@wasm.convert_s_int64_to_float32"
37
+ provide primitive convertI64U = "@wasm.convert_u_int64_to_float32"
38
+ provide primitive demoteF64 = "@wasm.demote_float64"
@@ -1,168 +1,176 @@
1
- ### Wasmf32.**load**
1
+ ---
2
+ title: WasmF32
3
+ ---
4
+
5
+ ## Values
6
+
7
+ Functions and constants included in the WasmF32 module.
8
+
9
+ ### WasmF32.**load**
2
10
 
3
11
  ```grain
4
- load : (WasmI32, WasmI32) -> WasmF32
12
+ load : (ptr: WasmI32, offset: WasmI32) => WasmF32
5
13
  ```
6
14
 
7
- ### Wasmf32.**store**
15
+ ### WasmF32.**store**
8
16
 
9
17
  ```grain
10
- store : (WasmI32, WasmF32, WasmI32) -> Void
18
+ store : (ptr: WasmI32, value: WasmF32, offset: WasmI32) => Void
11
19
  ```
12
20
 
13
- ### Wasmf32.**neg**
21
+ ### WasmF32.**neg**
14
22
 
15
23
  ```grain
16
- neg : WasmF32 -> WasmF32
24
+ neg : (num: WasmF32) => WasmF32
17
25
  ```
18
26
 
19
- ### Wasmf32.**abs**
27
+ ### WasmF32.**abs**
20
28
 
21
29
  ```grain
22
- abs : WasmF32 -> WasmF32
30
+ abs : (num: WasmF32) => WasmF32
23
31
  ```
24
32
 
25
- ### Wasmf32.**ceil**
33
+ ### WasmF32.**ceil**
26
34
 
27
35
  ```grain
28
- ceil : WasmF32 -> WasmF32
36
+ ceil : (num: WasmF32) => WasmF32
29
37
  ```
30
38
 
31
- ### Wasmf32.**floor**
39
+ ### WasmF32.**floor**
32
40
 
33
41
  ```grain
34
- floor : WasmF32 -> WasmF32
42
+ floor : (num: WasmF32) => WasmF32
35
43
  ```
36
44
 
37
- ### Wasmf32.**trunc**
45
+ ### WasmF32.**trunc**
38
46
 
39
47
  ```grain
40
- trunc : WasmF32 -> WasmF32
48
+ trunc : (num: WasmF32) => WasmF32
41
49
  ```
42
50
 
43
- ### Wasmf32.**nearest**
51
+ ### WasmF32.**nearest**
44
52
 
45
53
  ```grain
46
- nearest : WasmF32 -> WasmF32
54
+ nearest : (num: WasmF32) => WasmF32
47
55
  ```
48
56
 
49
- ### Wasmf32.**sqrt**
57
+ ### WasmF32.**sqrt**
50
58
 
51
59
  ```grain
52
- sqrt : WasmF32 -> WasmF32
60
+ sqrt : (num: WasmF32) => WasmF32
53
61
  ```
54
62
 
55
- ### Wasmf32.**add**
63
+ ### WasmF32.**(+)**
56
64
 
57
65
  ```grain
58
- add : (WasmF32, WasmF32) -> WasmF32
66
+ (+) : (left: WasmF32, right: WasmF32) => WasmF32
59
67
  ```
60
68
 
61
- ### Wasmf32.**sub**
69
+ ### WasmF32.**(-)**
62
70
 
63
71
  ```grain
64
- sub : (WasmF32, WasmF32) -> WasmF32
72
+ (-) : (left: WasmF32, right: WasmF32) => WasmF32
65
73
  ```
66
74
 
67
- ### Wasmf32.**mul**
75
+ ### WasmF32.**(*)**
68
76
 
69
77
  ```grain
70
- mul : (WasmF32, WasmF32) -> WasmF32
78
+ (*) : (left: WasmF32, right: WasmF32) => WasmF32
71
79
  ```
72
80
 
73
- ### Wasmf32.**div**
81
+ ### WasmF32.**(/)**
74
82
 
75
83
  ```grain
76
- div : (WasmF32, WasmF32) -> WasmF32
84
+ (/) : (left: WasmF32, right: WasmF32) => WasmF32
77
85
  ```
78
86
 
79
- ### Wasmf32.**copySign**
87
+ ### WasmF32.**copySign**
80
88
 
81
89
  ```grain
82
- copySign : (WasmF32, WasmF32) -> WasmF32
90
+ copySign : (left: WasmF32, right: WasmF32) => WasmF32
83
91
  ```
84
92
 
85
- ### Wasmf32.**min**
93
+ ### WasmF32.**min**
86
94
 
87
95
  ```grain
88
- min : (WasmF32, WasmF32) -> WasmF32
96
+ min : (left: WasmF32, right: WasmF32) => WasmF32
89
97
  ```
90
98
 
91
- ### Wasmf32.**max**
99
+ ### WasmF32.**max**
92
100
 
93
101
  ```grain
94
- max : (WasmF32, WasmF32) -> WasmF32
102
+ max : (left: WasmF32, right: WasmF32) => WasmF32
95
103
  ```
96
104
 
97
- ### Wasmf32.**eq**
105
+ ### WasmF32.**(==)**
98
106
 
99
107
  ```grain
100
- eq : (WasmF32, WasmF32) -> Bool
108
+ (==) : (left: WasmF32, right: WasmF32) => Bool
101
109
  ```
102
110
 
103
- ### Wasmf32.**ne**
111
+ ### WasmF32.**(!=)**
104
112
 
105
113
  ```grain
106
- ne : (WasmF32, WasmF32) -> Bool
114
+ (!=) : (left: WasmF32, right: WasmF32) => Bool
107
115
  ```
108
116
 
109
- ### Wasmf32.**lt**
117
+ ### WasmF32.**(<)**
110
118
 
111
119
  ```grain
112
- lt : (WasmF32, WasmF32) -> Bool
120
+ (<) : (left: WasmF32, right: WasmF32) => Bool
113
121
  ```
114
122
 
115
- ### Wasmf32.**le**
123
+ ### WasmF32.**(<=)**
116
124
 
117
125
  ```grain
118
- le : (WasmF32, WasmF32) -> Bool
126
+ (<=) : (left: WasmF32, right: WasmF32) => Bool
119
127
  ```
120
128
 
121
- ### Wasmf32.**gt**
129
+ ### WasmF32.**(>)**
122
130
 
123
131
  ```grain
124
- gt : (WasmF32, WasmF32) -> Bool
132
+ (>) : (left: WasmF32, right: WasmF32) => Bool
125
133
  ```
126
134
 
127
- ### Wasmf32.**ge**
135
+ ### WasmF32.**(>=)**
128
136
 
129
137
  ```grain
130
- ge : (WasmF32, WasmF32) -> Bool
138
+ (>=) : (left: WasmF32, right: WasmF32) => Bool
131
139
  ```
132
140
 
133
- ### Wasmf32.**reinterpretI32**
141
+ ### WasmF32.**reinterpretI32**
134
142
 
135
143
  ```grain
136
- reinterpretI32 : WasmI32 -> WasmF32
144
+ reinterpretI32 : (num: WasmI32) => WasmF32
137
145
  ```
138
146
 
139
- ### Wasmf32.**convertI32S**
147
+ ### WasmF32.**convertI32S**
140
148
 
141
149
  ```grain
142
- convertI32S : WasmI32 -> WasmF32
150
+ convertI32S : (num: WasmI32) => WasmF32
143
151
  ```
144
152
 
145
- ### Wasmf32.**convertI32U**
153
+ ### WasmF32.**convertI32U**
146
154
 
147
155
  ```grain
148
- convertI32U : WasmI32 -> WasmF32
156
+ convertI32U : (num: WasmI32) => WasmF32
149
157
  ```
150
158
 
151
- ### Wasmf32.**convertI64S**
159
+ ### WasmF32.**convertI64S**
152
160
 
153
161
  ```grain
154
- convertI64S : WasmI64 -> WasmF32
162
+ convertI64S : (num: WasmI64) => WasmF32
155
163
  ```
156
164
 
157
- ### Wasmf32.**convertI64U**
165
+ ### WasmF32.**convertI64U**
158
166
 
159
167
  ```grain
160
- convertI64U : WasmI64 -> WasmF32
168
+ convertI64U : (num: WasmI64) => WasmF32
161
169
  ```
162
170
 
163
- ### Wasmf32.**demoteF64**
171
+ ### WasmF32.**demoteF64**
164
172
 
165
173
  ```grain
166
- demoteF64 : WasmF64 -> WasmF32
174
+ demoteF64 : (num: WasmF64) => WasmF32
167
175
  ```
168
176
 
@@ -1,44 +1,38 @@
1
- /* grainc-flags --compilation-mode=runtime */
1
+ @runtimeMode
2
+ module WasmF64
2
3
 
3
4
  // WebAssembly Memory Instructions
4
- export primitive load: (WasmI32, WasmI32) -> WasmF64 = "@wasm.load_float64"
5
- export primitive store: (
6
- WasmI32,
7
- WasmF64,
8
- WasmI32,
9
- ) -> Void = "@wasm.store_float64"
5
+ provide primitive load = "@wasm.load_float64"
6
+ provide primitive store = "@wasm.store_float64"
10
7
 
11
8
  // WebAssembly Unary Instructions
12
- export primitive neg: WasmF64 -> WasmF64 = "@wasm.neg_float64"
13
- export primitive abs: WasmF64 -> WasmF64 = "@wasm.abs_float64"
14
- export primitive ceil: WasmF64 -> WasmF64 = "@wasm.ceil_float64"
15
- export primitive floor: WasmF64 -> WasmF64 = "@wasm.floor_float64"
16
- export primitive trunc: WasmF64 -> WasmF64 = "@wasm.trunc_float64"
17
- export primitive nearest: WasmF64 -> WasmF64 = "@wasm.nearest_float64"
18
- export primitive sqrt: WasmF64 -> WasmF64 = "@wasm.sqrt_float64"
9
+ provide primitive neg = "@wasm.neg_float64"
10
+ provide primitive abs = "@wasm.abs_float64"
11
+ provide primitive ceil = "@wasm.ceil_float64"
12
+ provide primitive floor = "@wasm.floor_float64"
13
+ provide primitive trunc = "@wasm.trunc_float64"
14
+ provide primitive nearest = "@wasm.nearest_float64"
15
+ provide primitive sqrt = "@wasm.sqrt_float64"
19
16
 
20
17
  // WebAssembly Binary Instructions
21
- export primitive add: (WasmF64, WasmF64) -> WasmF64 = "@wasm.add_float64"
22
- export primitive sub: (WasmF64, WasmF64) -> WasmF64 = "@wasm.sub_float64"
23
- export primitive mul: (WasmF64, WasmF64) -> WasmF64 = "@wasm.mul_float64"
24
- export primitive div: (WasmF64, WasmF64) -> WasmF64 = "@wasm.div_float64"
25
- export primitive copySign: (
26
- WasmF64,
27
- WasmF64,
28
- ) -> WasmF64 = "@wasm.copy_sign_float64"
29
- export primitive min: (WasmF64, WasmF64) -> WasmF64 = "@wasm.min_float64"
30
- export primitive max: (WasmF64, WasmF64) -> WasmF64 = "@wasm.max_float64"
31
- export primitive eq: (WasmF64, WasmF64) -> Bool = "@wasm.eq_float64"
32
- export primitive ne: (WasmF64, WasmF64) -> Bool = "@wasm.ne_float64"
33
- export primitive lt: (WasmF64, WasmF64) -> Bool = "@wasm.lt_float64"
34
- export primitive le: (WasmF64, WasmF64) -> Bool = "@wasm.le_float64"
35
- export primitive gt: (WasmF64, WasmF64) -> Bool = "@wasm.gt_float64"
36
- export primitive ge: (WasmF64, WasmF64) -> Bool = "@wasm.ge_float64"
18
+ provide primitive (+) = "@wasm.add_float64"
19
+ provide primitive (-) = "@wasm.sub_float64"
20
+ provide primitive (*) = "@wasm.mul_float64"
21
+ provide primitive (/) = "@wasm.div_float64"
22
+ provide primitive copySign = "@wasm.copy_sign_float64"
23
+ provide primitive min = "@wasm.min_float64"
24
+ provide primitive max = "@wasm.max_float64"
25
+ provide primitive (==) = "@wasm.eq_float64"
26
+ provide primitive (!=) = "@wasm.ne_float64"
27
+ provide primitive (<) = "@wasm.lt_float64"
28
+ provide primitive (<=) = "@wasm.le_float64"
29
+ provide primitive (>) = "@wasm.gt_float64"
30
+ provide primitive (>=) = "@wasm.ge_float64"
37
31
 
38
32
  // WebAssembly Conversion instructions
39
- export primitive reinterpretI64: WasmI64 -> WasmF64 = "@wasm.reinterpret_int64"
40
- export primitive convertI32S: WasmI32 -> WasmF64 = "@wasm.convert_s_int32_to_float64"
41
- export primitive convertI32U: WasmI32 -> WasmF64 = "@wasm.convert_u_int32_to_float64"
42
- export primitive convertI64S: WasmI64 -> WasmF64 = "@wasm.convert_s_int64_to_float64"
43
- export primitive convertI64U: WasmI64 -> WasmF64 = "@wasm.convert_u_int64_to_float64"
44
- export primitive promoteF32: WasmF32 -> WasmF64 = "@wasm.promote_float32"
33
+ provide primitive reinterpretI64 = "@wasm.reinterpret_int64"
34
+ provide primitive convertI32S = "@wasm.convert_s_int32_to_float64"
35
+ provide primitive convertI32U = "@wasm.convert_u_int32_to_float64"
36
+ provide primitive convertI64S = "@wasm.convert_s_int64_to_float64"
37
+ provide primitive convertI64U = "@wasm.convert_u_int64_to_float64"
38
+ provide primitive promoteF32 = "@wasm.promote_float32"