LIVE DEMO: https://leanprover.github.com/live
COMPILED JS: https://leanprover.github.io/lean.js/lean.js
This is a project to aid porting Lean code to Javascript using an amazing tool called Emscripten. It includes an Emscripten build for GMP, MPFR, and LUA (dependencies of Lean), which may be of use in their own right. This repository is based on cgaljs.
Note that this package only works on 32-bit virtual machines. We have tested it on Ubuntu-14.04 (32-bit) machines.
We host the latest version of compiled javascript at gh-pages branch of this repository. You can access it via https://leanprover.github.io/lean.js/lean.js. You can also link the compiled javascript from your HTML code:
<script src="https://leanprover.github.io/lean.js/lean.js" type="text/javascript" charset="utf-8"></script>
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y build-essential cmake python2.7 nodejs default-jre git wget m4
sudo apt-get install -y libgmp-dev libmpfr-dev liblua5.2-dev gcc
sudo apt-get install -y nodejs-legacy # If the executable of node.js is `nodejs` instead of `node`
wget https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz
tar xvf emsdk-portable.tar.gz
cd emsdk_portable
./emsdk update
./emsdk install sdk-tag-1.30.6-32bit emscripten-tag-1.30.6-32bit clang-tag-e1.30.6-32bit
./emsdk activate sdk-tag-1.30.6-32bit emscripten-tag-1.30.6-32bit clang-tag-e1.30.6-32bit
After running ./emsdk activate sdk-tag-1.30.6-32bit emscripten-tag-1.30.6-32bit clang-tag-e1.30.6-32bit
, you get the following message:
To conveniently access the selected set of tools from the command line, consider adding the following directories to PATH, or call 'source ./emsdk_env.sh' to do this for you.
/home/PATH/TO/emsdk_portable:/home/PATH/TO/emsdk_portable/clang/fastcomp/build_master_32/bin:/home/PATH/TO/emsdk_portable/emscripten/master
Make sure to add the last line to the PATH
variable in your shell configuration. For instance, if you are using bash, add the following to your ~/.bashrc
.
PATH=/home/PATH/TO/emsdk_portable:/home/PATH/TO/emsdk_portable/clang/fastcomp/build_master_32/bin:/home/PATH/TO/emsdk_portable/emscripten/master:$PATH
Execute the following script to checkout and build lean.js.
git clone https://github.com/leanprover/lean.js
cd lean.js
make
- The generated
lean.js
file is located atbuild/lean_js/source/lean-master/shell
directory. make push
will destructively update thegh-pages
branch oforigin
repository.
- Simple example of using
lean.js
, written by Prof. Nathan Carter.