Skip to content
/ Moth Public
forked from smarr/Moth

Self-Optimising Grace from Self-Optimising Newspeak

License

Notifications You must be signed in to change notification settings

gracelang/Moth

 
 

Repository files navigation

Moth

Note: The Moth project is under active development.

Moth is a new interpreter offering high performance for long-running Grace programs. Moth is built on top of SOMns v0.6 and while it achieves great peak-performance we still have some way to go before realizing a complaint Grace implementation.

Contents

To get started have a look at Getting Ready for dependencies and then the 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.

Status

The latest release is reflected by the master branch Build Status.

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 for the AWFY benchmarks; more information can be found in our preprint.

Getting Ready

Moth consists of three repositories:

  • SOMns - our fork that adapts SOMns to provide Grace support,
  • Kernan - a Grace interpreter written in C#, and
  • GraceLibrary - a collection of Grace programs, tests, and benchmarks designed to be used in Moth.

To successfully build Kernan, you will need to have the xbuild installed on your machine. The best way to obtain this is to downloaded the latest release of the mono (an umbrella project focuses on bringing better cross-platform tooling and support to Microsoft products).

To successfully build SOMns, you will need to have Apache's ANT command line tool (easily installed through most package managers) and a version of Java that implements the compiler interface. We are currently using version 10.0.1.

Install

This one is simple, just run our build script 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:

Buildfile: .../Moth/build.xml

compile-kernan:
    [echo] Compiling Kernan
    ...
    [exec] Build succeeded.
    [exec]      0 Warning(s)
    [exec]      0 Error(s)
    [exec]
    [exec] Time Elapsed 00:00:06.2428680

compile-somns:
     [echo] Compiling SOMns
     [echo]
     [echo]         ant.java.version: 10
     [echo]         java.version:     10.0.1
     [echo]         is.atLeastJava9:  true
     ...
     compile:
     [echo] Compiling Moth

BUILD SUCCESSFUL
Total time: 2 minutes 7 seconds

Provided both Kernan and Moth compiled as expected, you can now run Grace programs using the moth executable:

./moth GraceLibrary/hello.grace

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.

Running Grace

Running a Grace program is simple; you invoke the 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.

We maintain a small test suite, which can be executed via the Test Runner 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).

Finally, you may also run Moth in benchmarking mode. To do this, execute the harness along with a Grace benchmark and the iteration numbers you want to use. For example, executing:

./moth GraceLibrary/Benchmarks/harness.grace GraceLibrary/Benchmarks/List.grace 100 50

About

Self-Optimising Grace from Self-Optimising Newspeak

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 72.1%
  • Python 27.9%