File tree 4 files changed +14
-13
lines changed
4 files changed +14
-13
lines changed Original file line number Diff line number Diff line change 2
2
3
3
Shortcuts for wasm
4
4
5
- | wasm-hl | wasm |
5
+ | wah | 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)) ` |
@@ -23,7 +23,7 @@ Shortcuts for wasm
23
23
24
24
FIXME: explanation
25
25
26
- $ java -jar wasm-hl -0.1.0-standalone.jar [args]
26
+ $ java -jar wah -0.1.0-standalone.jar [args]
27
27
28
28
## Options
29
29
Original file line number Diff line number Diff line change 1
- (defproject wasm-hl " 0.1.0-SNAPSHOT"
2
- :description " FIXME: write description "
1
+ (defproject wah " 0.1.0-SNAPSHOT"
2
+ :description " Convenience syntax for WAST "
3
3
:url " http://example.com/FIXME"
4
+ :test-paths [" src" ]
4
5
:license {:name " Eclipse Public License"
5
6
:url " http://www.eclipse.org/legal/epl-v10.html" }
6
7
:dependencies [
7
8
[org.clojure/tools.cli " 0.3.5" ]
8
9
[org.clojure/tools.reader " 1.0.0-beta4" ]
9
10
[org.clojure/clojure " 1.8.0" ]]
10
11
:plugins [[lein-cljfmt " 0.5.6" ]]
11
- :main ^:skip-aot wasm-hl .core
12
+ :main ^:skip-aot wah .core
12
13
:target-path " target/%s"
13
14
:profiles {:uberjar {:aot :all }})
File renamed without changes.
Original file line number Diff line number Diff line change 1
- (ns wasm-hl .core
1
+ (ns wah .core
2
2
(:require [clojure.tools.cli :refer [cli]])
3
3
(:require [clojure.tools.reader.edn :as edn])
4
4
(:require [clojure.walk :as w])
149
149
(is (= {:type 'i32} (meta (assign-final-types {'$f 'i32} '(get_local $f))))))
150
150
151
151
(with-test
152
- (defn wasm-hl -to-wasm
152
+ (defn wah -to-wasm
153
153
" Transform a wasm hl edn to a wasm edn"
154
154
[expr]
155
155
(let [arranged-tree (w/prewalk
159
159
(w/postwalk
160
160
(partial assign-final-types type-map)
161
161
arranged-tree)))
162
- (is (= '(i32.add (i32.const 0 ) (i32.const 0 )) (wasm-hl -to-wasm '(0 + 0 ))))
163
- (is (= '(i32.add (i32.const 0 ) (i32.add (i32.const 0 ) (i32.const 1 ))) (wasm-hl -to-wasm '(0 + (0 + 1 )))))
164
- (is (= '(f64.add (f64.const 0.0 ) (f64.const 1.0 )) (wasm-hl -to-wasm '(0.0 + 1.0 ))))
165
- (is (= '(func (local $foo f64) (f64.add (f64.const 0.0 ) (get_local $foo))) (wasm-hl -to-wasm '(func (local $foo f64) (0.0 + %$foo)))))
166
- (is (= 'i32 (get (meta (second (wasm-hl -to-wasm '(0 + 0 )))) :type ))))
162
+ (is (= '(i32.add (i32.const 0 ) (i32.const 0 )) (wah -to-wasm '(0 + 0 ))))
163
+ (is (= '(i32.add (i32.const 0 ) (i32.add (i32.const 0 ) (i32.const 1 ))) (wah -to-wasm '(0 + (0 + 1 )))))
164
+ (is (= '(f64.add (f64.const 0.0 ) (f64.const 1.0 )) (wah -to-wasm '(0.0 + 1.0 ))))
165
+ (is (= '(func (local $foo f64) (f64.add (f64.const 0.0 ) (get_local $foo))) (wah -to-wasm '(func (local $foo f64) (0.0 + %$foo)))))
166
+ (is (= 'i32 (get (meta (second (wah -to-wasm '(0 + 0 )))) :type ))))
167
167
168
168
(defn -main
169
169
" compile wast-hl to wast"
172
172
[" -h" " --help" " Print this help"
173
173
:default false :flag true ])]
174
174
(clojure.pprint/pprint
175
- (wasm-hl -to-wasm (edn/read-string (slurp (first args)))))))
175
+ (wah -to-wasm (edn/read-string (slurp (first args)))))))
You can’t perform that action at this time.
0 commit comments