1
- # wasm-hl
1
+ # wah
2
2
3
3
Shortcuts for wasm
4
4
5
5
| wasm-hl | wasm |
6
6
| ---------------| -------------------------------------------|
7
7
| ` (0 = 1) ` | ` (set_local 0 (f64.const 0)) ` |
8
8
| ` (%$a + %$b) ` | ` (f64.add (get_local $a) (get_local $b)) ` |
9
+ | ` (0 + 1) ` | ` (i32.add (i32.const 0) (i32.const 1)) ` |
10
+ | ` (0.0 + 1.0) ` | ` (f64.add (f64.const 0) (f64.const 1)) ` |
9
11
10
- * Adds infix operators: ` * ` , +, -, / (all compile to f64 right now)
12
+ * Adds infix operators: ` *, +, -, /, ==, >, <, >=, <= `
11
13
* Supports (0 = 1) shortcut for ` set_local `
12
- * Supports bare numbers that become f64.const
14
+ * Supports bare numbers that become f64.const if they have a decimal point, and
15
+ i32.const if they don't.
16
+ * Supports type inference by walking up the tree, paying attention to param
17
+ and local types.
13
18
14
19
## Installation
15
20
16
- Download from http://example.com/FIXME .
17
21
18
22
## Usage
19
23
@@ -23,8 +27,6 @@ FIXME: explanation
23
27
24
28
## Options
25
29
26
- FIXME: listing of options this app accepts.
27
-
28
30
## Examples
29
31
30
32
...
@@ -33,84 +35,9 @@ FIXME: listing of options this app accepts.
33
35
34
36
...
35
37
36
- ### Any Other Sections
37
- ### That You Think
38
- ### Might be Useful
39
-
40
38
## License
41
39
42
- Copyright © 2017 FIXME
40
+ Copyright © 2017 Tom MacWright
43
41
44
42
Distributed under the Eclipse Public License either version 1.0 or (at
45
43
your option) any later version.
46
-
47
- ;; From https://github.com/WebAssembly/design/blob/master/Semantics.md
48
- ;; ` f32.add ` : addition
49
- ;; ` f32.sub ` : subtraction
50
- ;; ` f32.mul ` : multiplication
51
- ;; ` f32.div ` : division
52
- ;; ` f32.abs ` : absolute value
53
- ;; ` f32.neg ` : negation
54
- ;; ` f32.copysign ` : copysign
55
- ;; ` f32.ceil ` : ceiling operator
56
- ;; ` f32.floor ` : floor operator
57
- ;; ` f32.trunc ` : round to nearest integer towards zero
58
- ;; ` f32.nearest ` : round to nearest integer, ties to even
59
- ;; ` f32.eq ` : compare ordered and equal
60
- ;; ` f32.ne ` : compare unordered or unequal
61
- ;; ` f32.lt ` : compare ordered and less than
62
- ;; ` f32.le ` : compare ordered and less than or equal
63
- ;; ` f32.gt ` : compare ordered and greater than
64
- ;; ` f32.ge ` : compare ordered and greater than or equal
65
- ;; ` f32.sqrt ` : square root
66
- ;; ` f32.min ` : minimum (binary operator); if either operand is NaN, returns NaN
67
- ;; ` f32.max ` : maximum (binary operator); if either operand is NaN, returns NaN
68
- ;; ` f64.add ` : addition
69
- ;; ` f64.sub ` : subtraction
70
- ;; ` f64.mul ` : multiplication
71
- ;; ` f64.div ` : division
72
- ;; ` f64.abs ` : absolute value
73
- ;; ` f64.neg ` : negation
74
- ;; ` f64.copysign ` : copysign
75
- ;; ` f64.ceil ` : ceiling operator
76
- ;; ` f64.floor ` : floor operator
77
- ;; ` f64.trunc ` : round to nearest integer towards zero
78
- ;; ` f64.nearest ` : round to nearest integer, ties to even
79
- ;; ` f64.eq ` : compare ordered and equal
80
- ;; ` f64.ne ` : compare unordered or unequal
81
- ;; ` f64.lt ` : compare ordered and less than
82
- ;; ` f64.le ` : compare ordered and less than or equal
83
- ;; ` f64.gt ` : compare ordered and greater than
84
- ;; ` f64.ge ` : compare ordered and greater than or equal
85
- ;; ` f64.sqrt ` : square root
86
- ;; ` f64.min ` : minimum (binary operator); if either operand is NaN, returns NaN
87
- ;; ` f64.max ` : maximum (binary operator); if either operand is NaN, returns NaN
88
- ;; ` i32.add ` : sign-agnostic addition
89
- ;; ` i32.sub ` : sign-agnostic subtraction
90
- ;; ` i32.mul ` : sign-agnostic multiplication (lower 32-bits)
91
- ;; ` i32.div_s ` : signed division (result is truncated toward zero)
92
- ;; ` i32.div_u ` : unsigned division (result is [ floored] ( https://en.wikipedia.org/wiki/Floor_and_ceiling_functions ) )
93
- ;; ` i32.rem_s ` : signed remainder (result has the sign of the dividend)
94
- ;; ` i32.rem_u ` : unsigned remainder
95
- ;; ` i32.and ` : sign-agnostic bitwise and
96
- ;; ` i32.or ` : sign-agnostic bitwise inclusive or
97
- ;; ` i32.xor ` : sign-agnostic bitwise exclusive or
98
- ;; ` i32.shl ` : sign-agnostic shift left
99
- ;; ` i32.shr_u ` : zero-replicating (logical) shift right
100
- ;; ` i32.shr_s ` : sign-replicating (arithmetic) shift right
101
- ;; ` i32.rotl ` : sign-agnostic rotate left
102
- ;; ` i32.rotr ` : sign-agnostic rotate right
103
- ;; ` i32.eq ` : sign-agnostic compare equal
104
- ;; ` i32.ne ` : sign-agnostic compare unequal
105
- ;; ` i32.lt_s ` : signed less than
106
- ;; ` i32.le_s ` : signed less than or equal
107
- ;; ` i32.lt_u ` : unsigned less than
108
- ;; ` i32.le_u ` : unsigned less than or equal
109
- ;; ` i32.gt_s ` : signed greater than
110
- ;; ` i32.ge_s ` : signed greater than or equal
111
- ;; ` i32.gt_u ` : unsigned greater than
112
- ;; ` i32.ge_u ` : unsigned greater than or equal
113
- ;; ` i32.clz ` : sign-agnostic count leading zero bits (All zero bits are considered leading if the value is zero)
114
- ;; ` i32.ctz ` : sign-agnostic count trailing zero bits (All zero bits are considered trailing if the value is zero)
115
- ;; ` i32.popcnt ` : sign-agnostic count number of one bits
116
- ;; ` i32.eqz ` : compare equal to zero (return 1 if operand is zero, 0 otherwise)
0 commit comments