-
Notifications
You must be signed in to change notification settings - Fork 529
[interpreter] Change how wast.js is built by using Js_of_ocaml #1507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4148f10
[interpreter] Fix Makefile for wast.js build
takikawa c7aab24
[interpreter] Add dune build stanza for wast.js
takikawa b50c462
[interpreter]: modify wast.js target
takikawa dbabef2
[interpreter]: address PR feedback
takikawa 35a7bbb
[interpreter]: adjust wast.js documentation
takikawa 4a4fc5e
[interpreter]: create GH action for wast.js
takikawa 54bc584
[interpreter]: minor fix in wast.js example
takikawa 94fee80
[interpreter]: address additional feedback
takikawa a443bed
[interpreter]: minor refactoring
takikawa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| open Js_of_ocaml | ||
|
takikawa marked this conversation as resolved.
|
||
|
|
||
| let decode (buf : Typed_array.arrayBuffer Js.t) width : (Js.js_string Js.t) = | ||
| let s = Typed_array.String.of_uint8Array (new%js Typed_array.uint8Array_fromBuffer buf) in | ||
| let m = Decode.decode "(decode)" s in | ||
| Js.string (Sexpr.to_string width (Arrange.module_ m)) | ||
|
|
||
| let _ = | ||
| Js.export "WebAssemblyText" | ||
| (object%js (_self) | ||
|
|
||
| method encode (s : Js.js_string Js.t) : (Typed_array.arrayBuffer Js.t) = | ||
| let def = Parse.string_to_module (Js.to_string s) in | ||
| let bs = | ||
| match def.Source.it with | ||
| | Script.Textual m -> (Encode.encode m) | ||
| | Script.Encoded (_, bs) -> bs in | ||
| let buf = new%js Typed_array.arrayBuffer (String.length bs) in | ||
| let u8arr = new%js Typed_array.uint8Array_fromBuffer buf in | ||
| String.iteri (fun i c -> Typed_array.set u8arr i (int_of_char c)) bs; buf | ||
|
|
||
| method decode buf = decode buf 80 | ||
| method decode2 buf width = decode buf width | ||
|
takikawa marked this conversation as resolved.
Outdated
|
||
|
|
||
| end) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.