File tree 4 files changed +72
-0
lines changed
4 files changed +72
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,10 @@ Shortcuts for wasm
20
20
21
21
## [ Introduction] ( doc/intro.md )
22
22
23
+ ## [ Flow] ( doc/flow.md )
24
+
25
+ ## [ Rationale] ( doc/rationale.md )
26
+
23
27
## [ Planning] ( doc/planning.md )
24
28
25
29
## Contributing & open source
Original file line number Diff line number Diff line change
1
+
2
+ ┌─────────────────┐
3
+ ┌──│ wah source │
4
+ │ └─────────────────┘
5
+ │ is parsed as
6
+ │ ┌───────────────────────────────┐
7
+ ├──│edn (extensible data notation) │
8
+ │ └───────────────────────────────┘
9
+ │ by the
10
+ │ ┌───────────────┐
11
+ ├──│ wah compiler │────────────┐
12
+ │ └───────────────┘ │
13
+ │ written in │
14
+ │ ┌──────────┐ │
15
+ ├──│ clojure │ │
16
+ │ └──────────┘ │
17
+ │ which runs in the │
18
+ │ ┌──────────────────────┐ │
19
+ └─▶│ Java Virtual Machine │ │
20
+ └──────────────────────┘ │
21
+ │
22
+ │
23
+ generates │
24
+ ┌─────────────────────────┐ │
25
+ ┌──│ WebAssembly Text (WAST) │◀─┘
26
+ │ └─────────────────────────┘
27
+ │ is compiled by
28
+ │ ┌─────────────────────────────┐
29
+ ├──│ wabt (wast2wasm) │
30
+ │ └─────────────────────────────┘
31
+ │ into
32
+ │ ┌─────────────────────────────┐
33
+ └─▶│ WebAssembly Binary (wasm) │──┐
34
+ └─────────────────────────────┘ │
35
+ │
36
+ and links with │
37
+ ┌─────────────────────────────┐ │
38
+ │ JavaScript │◀─┘
39
+ └─────────────────────────────┘
Original file line number Diff line number Diff line change 39
39
(%0 + %1)
40
40
```
41
41
42
+ See [ the rationale explanation] ( ./rationale.md ) for more details about why this
43
+ might be useful and why I built it.
44
+
42
45
## The stack
43
46
44
47
The complete flow of using wah is:
@@ -48,6 +51,8 @@ The complete flow of using wah is:
48
51
* Compile WAST to WASM using [ wabt] ( https://github.com/webassembly/wabt ) 's ` wast2wasm `
49
52
* Load and run in a browser using the instantiation code like:
50
53
54
+ See [ the flow diagram] ( ./flow.txt ) for a graphical explanation.
55
+
51
56
``` js
52
57
fetch (' ./output.wasm' ).then (response =>
53
58
response .arrayBuffer ()
Original file line number Diff line number Diff line change
1
+ # Why wah?
2
+
3
+ Well, WebAssembly text isn't _ designed_ to be written from scratch, but it's
4
+ still writable, and really isn't that bad. wah makes WebAssembly text just
5
+ a little more humane, so that people with a need for extreme simplicity and
6
+ low-level access can get it.
7
+
8
+ WebAssembly will definitely, primarily, be a compilation target for things
9
+ like emscripten. But why not have some low-level mathematical code written in,
10
+ and purely written in, WebAssembly?
11
+
12
+ # Why is the compiler implemented in Clojure?
13
+
14
+ Clojure _ looks_ a lot like WebAssembly text format because they both use S-Expressions,
15
+ but, obviously, WebAssembly text format is not a lisp and has very little else
16
+ in common. The compiler is implemented in Clojure because of Clojure's excellent
17
+ support for the [ edn format] ( https://github.com/edn-format/edn ) , which fortunately
18
+ is a superset of WebAssembly text syntax. Clojure is also a very nice, functional
19
+ language with efficient and direct ways of expressing the kind of data-transformation
20
+ logic required for wah.
21
+
22
+ # Could it be implemented in ClojureScript?
23
+
24
+ Sure! It might even already work in ClojureScript, I just haven't tried yet. PRs welcome!
You can’t perform that action at this time.
0 commit comments