Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 6d2995b051
Fetching contributors…

Cannot retrieve contributors at this time

119 lines (84 sloc) 3.652 kB
layout title
default
Documentation / User Guide

{% capture content %}

Getting Started

This page contains documentation specific to the JavaScript backend. To learn more of the UHC please look at the extensive documentation.

Installation of UHC

Clone the latest version of the JavaScript branch of UHC. This is somewhat risky but new features will be found here first.

Make sure you have the dependencies, also make sure you have GHC installed:

cabal install uulib uuagc

Now build the UHC:

$> cd somewhere
$> git clone git://github.com/UU-ComputerScience/uhc.git
$> cd uhc
$> git checkout js
$> cd EHC
$> autoconf
$> ./configure
$> make uhc

Optionally perform a make install.

Compiling a program

Compiling happens by calling UHC with the -tjs flag.

uhc -tjs Main.hs

This will compile Main.hs and generate a .js file for each import you made, as well as the main module. It will also create a file Main.html for you that contains a bare-bone HTML template including the references to the generated JavaScript code.

If you want the UHC to generate a single JavaScript file you can add the following parameter: -O,2. It will enable whole-program optimisation and output all JavaScript to the file Main.js.

As we do not yet have full Cabal support we currently resort to makefiles. (If someone wants to convert this to shake, please go ahead!)

COMPILER = $yourpath$ --import-path=$any_libraries_you_use$ -tjs -O,2

all: build

build: 
    ${COMPILER} main.hs

.PHONY clean:
    rm `find . -d -name "*.core*"`
    rm `find . -d -name "*.hi*"`

Communicating with JavaScript

We offer several bindings to JavaScript, jQuery, and BackBone. They can be found in the UHC-JavaScript library.

Examples / Practice

This is the list of currently active UHC-JS enabled projects:

Installation script for JCU-HS

An installation script for installing the JCU app together with its dependencies is available from this gist. Currently the script does not build nor install UHC for you.

If you trust us you may run the following command directly from your shell. It will run the installer in your current working directory:

{% highlight bash %} ruby <(curl -s https://raw.github.com/gist/1902090/0588a1a1e5a7bb8935ee9afdd7d96949abbe7ff5/install.rb) {% endhighlight %}

Follow the on screen instructions when running the installer.

{% endcapture %}

{{ content | markdownify }}
Jump to Line
Something went wrong with that request. Please try again.