From 29f12aa3cb75c8a3fab5e943a0640a2562ec1b62 Mon Sep 17 00:00:00 2001 From: Denis Merigoux Date: Fri, 12 Nov 2021 10:07:13 +0100 Subject: [PATCH] Building a JS version of the Catala compiler --- .nix/no-web.patch | 14 +++++++------- Makefile | 5 +++-- .../{catala_web.ml => catala_web_interpreter.ml} | 0 compiler/dune | 8 ++++---- generate_website_assets.sh | 2 +- 5 files changed, 15 insertions(+), 14 deletions(-) rename compiler/{catala_web.ml => catala_web_interpreter.ml} (100%) diff --git a/.nix/no-web.patch b/.nix/no-web.patch index 5db12f79..7bee9736 100644 --- a/.nix/no-web.patch +++ b/.nix/no-web.patch @@ -1,7 +1,7 @@ -diff --git a/compiler/catala_web.ml b/compiler/catala_web.ml +diff --git a/compiler/catala_web_interpreter.ml b/compiler/catala_web_interpreter.ml deleted file mode 100644 index 31d5289..0000000 ---- a/compiler/catala_web.ml +--- a/compiler/catala_web_interpreter.ml +++ /dev/null @@ -1,16 +0,0 @@ -open Driver @@ -27,17 +27,17 @@ index d192291..994c528 100644 @@ -10,16 +10,6 @@ (libraries calendar zarith zarith_stubs_js) (modules runtime)) - + -(executable -- (name catala_web) +- (name catala_web_interpreter) - (modes byte js) - (package catala) -- (public_name catala_web) -- (modules catala_web) +- (public_name catala_web_interpreter) +- (modules catala_web_interpreter) - (preprocess - (pps js_of_ocaml-ppx)) - (libraries catala.driver js_of_ocaml)) - (executable (name catala) - (modes native) \ No newline at end of file + (modes native) diff --git a/Makefile b/Makefile index d72e8e89..cb5b4a00 100644 --- a/Makefile +++ b/Makefile @@ -48,9 +48,10 @@ build: @$(MAKE) --no-print-directory format dune build $(COMPILER_DIR)/catala.exe -#> js_build : Builds the Web-compatible JS version of the Catala compiler +#> js_build : Builds the Web-compatible JS versions of the Catala compiler js_build: - dune build $(COMPILER_DIR)/catala_web.bc.js --profile release + dune build $(COMPILER_DIR)/catala.bc.js --profile release + dune build $(COMPILER_DIR)/catala_web_interpreter.bc.js --profile release #> doc : Generates the HTML OCaml documentation doc: diff --git a/compiler/catala_web.ml b/compiler/catala_web_interpreter.ml similarity index 100% rename from compiler/catala_web.ml rename to compiler/catala_web_interpreter.ml diff --git a/compiler/dune b/compiler/dune index d192291b..691779a0 100644 --- a/compiler/dune +++ b/compiler/dune @@ -11,18 +11,18 @@ (modules runtime)) (executable - (name catala_web) + (name catala_web_interpreter) (modes byte js) (package catala) - (public_name catala_web) - (modules catala_web) + (public_name catala_web_interpreter) + (modules catala_web_interpreter) (preprocess (pps js_of_ocaml-ppx)) (libraries catala.driver js_of_ocaml)) (executable (name catala) - (modes native) + (modes native js) (package catala) (modules catala) (public_name catala) diff --git a/generate_website_assets.sh b/generate_website_assets.sh index 8bfc1192..2826c0be 100755 --- a/generate_website_assets.sh +++ b/generate_website_assets.sh @@ -14,7 +14,7 @@ scp examples/tutorial_en/tutorial_en.html $1/ scp examples/tutoriel_fr/tutoriel_fr.html $1/ scp grammar.html $1/ scp catala.html $1/ -scp _build/default/compiler/catala_web.bc.js $1/playground/ +scp _build/default/compiler/catala_web_interpreter.bc.js $1/playground/ scp examples/tutorial_en/tutorial_en.catala_en $1/playground/ scp examples/tutoriel_fr/tutoriel_fr.catala_fr $1/playground/ cat examples/allocations_familiales/prologue.catala_fr > allocations_familiales.catala_fr