-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from juusaw/js-of-ocaml
Compile target: Javascript
- Loading branch information
Showing
8 changed files
with
337 additions
and
303 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,3 +1,19 @@ | ||
#!/bin/bash | ||
corebuild -use-menhir src/cli.native | ||
mv cli.native troll | ||
case "$1" in | ||
""|"native") | ||
echo "Compiling to native binary..." | ||
corebuild -use-menhir src/cli.native | ||
mv cli.native troll | ||
;; | ||
"javascript") | ||
echo "Compiling to Javascript..." | ||
ocamlbuild -use-ocamlfind -pkgs 'base,js_of_ocaml,js_of_ocaml.ppx' -use-menhir src/javascript.byte | ||
js_of_ocaml +base/runtime.js javascript.byte | ||
mv javascript.js troll.js | ||
;; | ||
*) | ||
echo "Illegal argument to build script" | ||
exit 1 | ||
;; | ||
esac | ||
exit 0 |
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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,10 @@ | ||
open Main | ||
|
||
module Javascript = | ||
struct | ||
let () = | ||
Js.export_all | ||
(object%js | ||
method run src = Main.main (Lexing.from_string (Js.to_string src)) 1 (Some 1) | ||
end) | ||
end |
This file contains 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 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 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 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