|
1 | 1 | # Moth
|
2 |
| -Self-Optimising Grace from Self-Optimising Newspeak |
| 2 | + |
| 3 | +Note: The Moth project is under active development. |
| 4 | + |
| 5 | +Moth is a new interpreter offering high performance for long-running [Grace](http://gracelang.org/) programs. Moth is built on top of [SOMns v0.6](https://github.com/smarr/SOMns/releases/tag/v0.6.0) and while it achieves great peak-performance we still have some way to go before realizing a complaint Grace implementation. |
| 6 | + |
| 7 | + |
| 8 | +Contents |
| 9 | +-------- |
| 10 | + |
| 11 | +To get started have a look at [Getting Ready](#getting-ready) for dependencies and then the [Install](#install) section for information about building the project (or just run `ant` from the root directory of Moth). From there we show how you can invoke tests, benchmarks, and your own programs in [Running Grace](#running-grace). |
| 12 | + |
| 13 | + |
| 14 | +Status |
| 15 | +------ |
| 16 | + |
| 17 | +The latest release is reflected by the `master` branch [](https://travis-ci.org/richard-roberts/Moth). |
| 18 | + |
| 19 | +Although we are working toward a compliant implementation, Moth doesn't yet implement all of Grace's features. Despite these drawbacks, peak performance is comparable to [V8](https://developers.google.com/v8/) for the AWFY benchmarks; more information can be found in our [preprint](https://arxiv.org/abs/1807.00661). |
| 20 | + |
| 21 | +Getting Ready |
| 22 | +------------- |
| 23 | + |
| 24 | +Moth consists of three repositories: |
| 25 | + |
| 26 | +- [SOMns](https://github.com/richard-roberts/SOMns) - our fork that adapts SOMns to provide Grace support, |
| 27 | +- [Kernan](http://gracelang.org/applications/grace-versions/kernan/) - a Grace interpreter written in C#, and |
| 28 | +- [GraceLibrary](https://github.com/richard-roberts/GraceLibrary) - a collection of Grace programs, tests, and benchmarks designed to be used in Moth. |
| 29 | + |
| 30 | +To successfully build Kernan, you will need to have the [xbuild](http://www.mono-project.com/docs/tools+libraries/tools/xbuild/) installed on your machine. The best way to obtain this is to downloaded the latest release of the [mono](https://www.mono-project.com/download/stable/) (an umbrella project focuses on bringing better cross-platform tooling and support to Microsoft products). |
| 31 | + |
| 32 | +To successfully build SOMns, you will need to have Apache's [ANT](https://ant.apache.org/) command line tool (easily installed through most package managers) and a version of [Java](http://www.oracle.com/technetwork/java/javase/downloads/index.html) that implements the [compiler interface](http://openjdk.java.net/jeps/243). We are currently using version **10.0.1**. |
| 33 | + |
| 34 | +Install |
| 35 | +------- |
| 36 | + |
| 37 | +This one is simple, just run our [build script](https://github.com/richard-roberts/Moth/blob/master/build.xml) by invoking `ant` from Moth's root directory. You will first see information about Kernan being built and then SOMns (the Grace library does not need to be compiled). Once everything has been built successfully, you should see something like the following output in your command line: |
| 38 | + |
| 39 | +```sh |
| 40 | +Buildfile: .../Moth/build.xml |
| 41 | + |
| 42 | +compile-kernan: |
| 43 | + [echo] Compiling Kernan |
| 44 | + ... |
| 45 | + [exec] Build succeeded. |
| 46 | + [exec] 0 Warning(s) |
| 47 | + [exec] 0 Error(s) |
| 48 | + [exec] |
| 49 | + [exec] Time Elapsed 00:00:06.2428680 |
| 50 | + |
| 51 | +compile-somns: |
| 52 | + [echo] Compiling SOMns |
| 53 | + [echo] |
| 54 | + [echo] ant.java.version: 10 |
| 55 | + [echo] java.version: 10.0.1 |
| 56 | + [echo] is.atLeastJava9: true |
| 57 | + ... |
| 58 | + compile: |
| 59 | + [echo] Compiling Moth |
| 60 | + |
| 61 | +BUILD SUCCESSFUL |
| 62 | +Total time: 2 minutes 7 seconds |
| 63 | +``` |
| 64 | + |
| 65 | +Provided both Kernan and Moth compiled as expected, you can now run Grace programs using the [moth](https://github.com/richard-roberts/Moth/blob/master/moth) executable: |
| 66 | + |
| 67 | +```sh |
| 68 | +./moth GraceLibrary/hello.grace |
| 69 | +``` |
| 70 | + |
| 71 | +Note that the `moth` executable will first set the `MOTH_HOME` environment variable to Moth's root directory and then start Kernan in the background before running Moth. When Moth is finished, the executable will conclude by terminating Kernan. |
| 72 | + |
| 73 | +Running Grace |
| 74 | +------------- |
| 75 | + |
| 76 | +Running a Grace program is simple; you invoke the [moth](https://github.com/richard-roberts/Moth/tree/master/moth) executable from the command line, along with the path to your program as the argument. For example, executing `./moth GraceLibrary/hello.grace` runs the hello world program. |
| 77 | + |
| 78 | +We maintain a small test suite, which can be executed via the [Test Runner](https://github.com/richard-roberts/GraceLibrary/tree/master/Tests/testRunner.grace) using `./moth -tc GraceLibrary/Tests/testRunner.grace` (the `-tc` argument turns on dynamic type-checking, which is required for some of the tests to pass). |
| 79 | + |
| 80 | +Finally, you may also run Moth in benchmarking mode. To do this, execute the [harness](https://github.com/richard-roberts/GraceLibrary/tree/master/Benchmarks/harness.grace) along with a [Grace benchmark](https://github.com/richard-roberts/GraceLibrary/tree/master/Benchmarks) and the iteration numbers you want to use. For example, executing: |
| 81 | + |
| 82 | +```sh |
| 83 | +./moth GraceLibrary/Benchmarks/harness.grace GraceLibrary/Benchmarks/List.grace 100 50 |
| 84 | +``` |
0 commit comments