Documentation

Articles

Contribute

Getting Started

At the moment, there are two ways you can run Whiley: via the Executable Jar, or through the Whiley Developement Kit.

Executable Jar

The easiest way to get Whiley running is to download the executable jar, which contains all files necessary to run the Whiley-to-Java Compiler.    Using the executable jar, you can run the compiler like so:

% java -jar wyjc-v0.3.2.jar hello-world.whiley

Here, hello-world.whiley is a very simple Whiley program.  You should see that a file called “hello-world.class” is produced by doing this.  To run the compiled program we can again use Java as follows:

% java -cp "wyjc-v0.3.2.jar:." hello-world
Hello World

If you make the program run and see it print “Hello World” as above, then you’ve got Whiley working!  To find out more about the various command-line options available,  see the Wyjc page.

Whiley Development Kit (WDK)

The Whiley Development Kit (WDK) includes the Whiley-to-Java Compiler (Wyjc), and provides several scripts to run it from the command-line.  The WDK includes the full source for the compiler, as well as numerous test cases, examples, and more.

You can download the WDK from here. In principle, the system should run out-of-the-box although, in practice, it’s easier to set up under UNIX.  If you want to run Whiley on a Windows machine, then I would highly recommend installing Cygwin – a UNIX environment for Windows (alternatively, download the executable jar discussed above).

When you expand the WDK tarball, you’ll find there are two scripts in the bin/ directory (wyjc and whiley). Set your PATH environment variable to point to that directory, and then you should be able to get going immediately.  For example:

% wyjc hello-world.whiley

Here, hello-world.whiley is very simple Whiley program. You should see that a file called “hello-world.class” is produced by doing this. To run the compiled program, we use the whiley script as follows:

% whiley hello-world
Hello World

If you make the program run and see it print “Hello World” as above, then you’ve got Whiley working!  To find out more about the various command-line options available,  see the Wyjc page.