Why would you want to use JSCaml?
So why would you use JSCaml at all? Two reasons come to mind:
That said, JSCaml is still incomplete and more work is needed before realistic programs can routinely be compiled and expected to just run without problems. So, unless you are interested to work on the compiler and its runtime, hang on for a bit and check back later.
Getting the sources
After cloning the JSCaml repository you also need to get hold of the submodules:
git submodule init git submodule update --recursive --init
Next, copy the relevant Webkit files to the runtime/regexp subdirectory and patch them to make them self contained.
cd regexp ./copy-patch-and-build.sh cd ..
Building the JSCaml compiler
First set up your environment as instructed in Flow repository, making sure that you can build and test Flow.
To build JSCaml use the buildcompiler.sh script in the compiler directory. It copies some files over into the flow sub directory, runs its make, copies the resulting extended flow binary back into the JSCaml bin directory and removes the copied files.
Building the JSCaml runtime
To build the runtime run the build.sh script in the runtime directory. This creates a bunch of files in the runtime/_build and runtime/_cobj directories, most of which are later required to be referenced by the ocamlopt call that compiles the translated (into OCaml) JS files together with the builtin object model binaries into a single executable.
It would be nice the JSCaml runtime could be packaged into a single file and if there were a simple way for ocamlopt get everything from the unified file, but this seems to be impossible. If you know how to do this, or can make it possible somehow, please help.
Running the JSCaml tests
In the early development of JSCaml modified versions of these tests have been actually been run and about 5000 of them pass, so there is hope.
In this repository, right now, there is a single "smoke alarm" test. To compile this test run the build.sh script. (This will actually compile all of the JS files in the directory.)
To run the test file, just run the .out/test binary.
JSCaml is BSD-licensed. We also provide an additional patent grant.