You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: data/tool_pages/platform/2ct_03_wasm.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@ category: "Compilation Targets"
9
9
OCaml can compile to WebAssembly (WASM), enabling you to run high-performance OCaml code in web browsers, on the server, and in embedded environments with near-native speed.
10
10
11
11
## What is WebAssembly?
12
+
12
13
WebAssembly is a binary instruction format designed as a portable compilation target for programming languages. It provides:
13
14
- Near-native performance in web browsers and standalone runtimes
14
15
- Sandboxed execution environment for security
@@ -18,6 +19,7 @@ WebAssembly is a binary instruction format designed as a portable compilation ta
18
19
## Available Tools
19
20
20
21
### wasm_of_ocaml
22
+
21
23
[wasm_of_ocaml](https://github.com/ocsigen/js_of_ocaml/blob/master/README_wasm_of_ocaml.md) compiles OCaml bytecode to WebAssembly. It provides:
22
24
- Full OCaml language support, including the standard library and OCaml 5 effects
23
25
- Compatibility with existing OCaml libraries
@@ -33,6 +35,7 @@ wasm_of_ocaml is ideal when you want to leverage existing OCaml code with WebAss
33
35
Visit the [wasm_of_ocaml documentation](https://github.com/ocsigen/js_of_ocaml/blob/master/README_wasm_of_ocaml.md) in the Js_of_ocaml repository to learn how to install and set up wasm_of_ocaml, compile OCaml programs to WebAssembly, interact with JavaScript APIs from WASM, and deploy WASM modules in web applications.
34
36
35
37
### Wasocaml
38
+
36
39
[Wasocaml](https://github.com/OCamlPro/wasocaml) is an OCaml compiler that targets WebAssembly GC (WASM-GC). Developed by OCamlPro, it provides:
37
40
- Direct compilation from OCaml's Flambda intermediate representation to WASM-GC
38
41
- Native WebAssembly garbage collection support
@@ -48,16 +51,19 @@ Wasocaml is ideal when you need direct compilation to WebAssembly with garbage c
48
51
Visit the [Wasocaml repository](https://github.com/OCamlPro/wasocaml) and [OCamlPro's blog posts](https://ocamlpro.com/blog/2022_12_14_wasm_and_ocaml/) to learn how to install the Wasocaml compiler switch, compile OCaml programs to WASM-GC, understand the compilation process and optimizations, and deploy to WebAssembly runtimes.
49
52
50
53
## Choosing a Tool
54
+
51
55
**Use wasm_of_ocaml** when you want to run existing OCaml bytecode in WebAssembly environments, need compatibility with Js_of_ocaml web bindings, or want a mature toolchain similar to Js_of_ocaml.
52
56
53
57
**Use Wasocaml** when you need direct compilation with Flambda optimizations, want to target the WebAssembly GC proposal, or are building performance-critical applications.
54
58
55
59
## Learn More
60
+
56
61
-[ocaml-wasm Organization](https://github.com/ocaml-wasm) - Coordination hub for OCaml WebAssembly efforts
57
62
-[WebAssembly.org](https://webassembly.org/) - WebAssembly specification and documentation
58
63
-[WASM-GC Proposal](https://github.com/WebAssembly/gc) - Garbage Collection proposal for WebAssembly
59
64
-[OCamlPro WASM Blog Posts](https://ocamlpro.com/blog/tags/wasm/) - Technical deep dives on Wasocaml
60
65
61
66
## Community
67
+
62
68
-[Discuss OCaml Forums](https://discuss.ocaml.org/) - Ask questions in the Ecosystem category
63
-
-[ocaml-wasm Updates](https://discuss.ocaml.org/tag/wasm) - Follow WebAssembly developments in OCaml
69
+
-[ocaml-wasm Updates](https://discuss.ocaml.org/tag/wasm) - Follow WebAssembly developments in OCaml
0 commit comments