Skip to content

Lean ported to Javascript with Emscripten

Notifications You must be signed in to change notification settings

nathancarter/lean.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lean.js

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>

Required Packages (on Ubuntu-14.04)

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

Build lean.js

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 at build/lean_js/source/lean-master/shell directory.
  • make push will destructively update the gh-pages branch of origin repository.

Examples

About

Lean ported to Javascript with Emscripten

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 51.4%
  • Makefile 25.5%
  • Shell 23.1%