A Church to Javascript compiler
JavaScript GCC Machine Description CSS Other
Permalink
Failed to load latest commit information.
dimple [dimple] Fix typo in a basic "if" test Jul 23, 2014
hooks Add pre-push hook Dec 28, 2014
lib Load builtin for including external Church/JS files May 17, 2014
online Remove some trailing whitespace Oct 2, 2015
probabilistic-js @ af8358d Fix bug in forward/backward logprob computations Nov 19, 2015
test Write named let (NB: it desugars to recursion, not iteration) Apr 8, 2016
.gitattributes Make font files binary Dec 28, 2014
.gitignore Gitignore minified webchurch Apr 22, 2015
.gitmodules Add probabilistic-js as submodule Sep 23, 2013
.travis.yml Set travis sudo to false; unlocks container builds (faster?) Dec 31, 2014
LICENSE.md Add MIT license Nov 9, 2015
README.md Remove yarn mode Mar 2, 2015
church Remove yarn mode Mar 2, 2015
church_astify.js Write named let (NB: it desugars to recursion, not iteration) Apr 8, 2016
church_builtins.js Make print an alias for display Jun 24, 2016
cm-brackets.js NO CAUSE FOR ALARM! May 10, 2014
cm-church.js Merge branch 'master' of github.com:probmods/webchurch Aug 5, 2014
cm-comments.js NO CAUSE FOR ALARM! May 10, 2014
cm-folding.js NO CAUSE FOR ALARM! May 10, 2014
compile.sh Add npm install to compile script Apr 22, 2015
debug.js [dimple] Add variable store so we can lookup earlier var types Jul 4, 2014
dimplify [dimple] Switch to Gibbs for default solver Jul 2, 2014
editor.js Fix mit-church runner shim Jul 9, 2014
evaluate.js Reset gensym counter in really_evaluate Dec 31, 2014
higher_order_builtins.js NO CAUSE FOR ALARM! May 10, 2014
js_astify.js added support for unquote-splicing.. Aug 4, 2014
make-docs.js Add eval to docs Jun 8, 2016
package.json Fix bug in forward/backward logprob computations Nov 19, 2015
precompile.js NO CAUSE FOR ALARM! May 10, 2014
server.js Support a minimal HTTP server that executes code in POST requests Sep 13, 2014
tester.js For now, show text of broken test cases Sep 4, 2014
tokenize.js Fix comment parsing bug on Windows #74 Jul 20, 2016
trace-to-dimple.js [dimple] Add variable store so we can lookup earlier var types Jul 4, 2014
trace.js Add a couple notes to trace.js Jun 13, 2014
type-utils.js Improve `mean` performance Jul 30, 2014
util.js Add formatting for regexes Mar 2, 2015
viz.js Fix number of bins bug in density Apr 8, 2016
wctransform.js Add global helper for human-readable addresses Mar 2, 2015
ww-stub.js NO CAUSE FOR ALARM! May 10, 2014

README.md

webchurch Build Status

Install

Dependencies

  • nodejs v0.10.26 (see package.json for npm dependencies). Some people have reported that v0.10.28 doesn't work but that switching to v0.10.26 does
  • Python (on Windows; version must be > 2.5 and < 3.0)

Installing with git (preferred method)

In a terminal, go to wherever you want your webchurch folder to live and run:

git clone https://github.com/probmods/webchurch.git
cd webchurch
git init ## only if you are on Windows
git submodule update --init --recursive
npm install
./compile.sh

Note that you only need to run git init on Windows.

To pull-in and work in a particular branch (say box2d):

lists all branches, local and remote to see what box2d is called on remote

git branch -a

setup local branch box2d to track remote branch box2d

git branch -b box2d remote/origin/box2d

switch to branch box2d

git checkout box2d

Installing without git

(not good for getting updates, but useful if you can't/don't want to get git installed)

  1. Download the webchurch ZIP
  2. Unarchive the zip file and go to that directory (called webchurch-master)
  3. Download probabilistic-js, unarchive this file, rename it to probabilistic-js, and move it into the webchurch-master folder (replacing the folder that's already there)
  4. In terminal, go to webchurch-master folder and run the following commands:

    npm install
    ./compile.sh
    

Making church a global command

If you want to be able to call church from anywhere on the command line, this is what you would do:

  1. If you don't alreay have a directory ~/bin, make that directory.
  2. Add a symbolic link to the church executable:

    ln -s path/to/webchurch/church ~/bin/
    
  3. If you don't already have a file called ~/.bash_profile, make that file

  4. Open that file and add the line:

    export PATH=$PATH:~/bin
    
  5. Re-open your terminal or source ~/.bash_profile

Now you can use the command church from any directory.

Usage

In a web browser

Open online/index.html. If you wish to use the load builtin for dynamically loading Church or Javascript libraries, you will need to access this page from the http:// protocol rather than the file:// protocol. We provide a simple way to do this. First, run npm run-script server on the command line and then point your browser to http://localhost:8080/online/index.html

On the command line

church [OPTIONS] [FILE] will run the contents of [FILE].

Available options:

  • -p, --precompile: Turn on pre-compilation (very experimental)
  • -a, --program-args [MESSAGE]: Arguments to pass to program. MESSAGE is sent to Church is the argstring variable.
  • -s, --seed [SEED]: Set the seed for the random number generator.
  • -t, --timed: Print out timing information.
  • -d, --desugar-only: Apply Church desugaring without execution.
  • -c, --compile-only: Compile to Javascript without execution.
  • -e, --disable-church-errors: Disable special Church error checking and show Javascript errors instead.