Libraries

MODL libraries will be added to this page as they are released. If you don't see a library in your programming language of choice you could build your own library based on the technical specification or sign-up for library alerts.

Creating a Library

If you would like to create a library, you can use the ANTLR4 grammar. Content on another site.

Ruby

The Ruby interpreter is available on GitHub Content on another site. and as a RubyGem. Content on another site.

To install the gem add this to your Gemfile:

copy to clipboard
gem "modl"
Ruby: Add the RubyGem to the Gemfile.

Then run Bundler:

copy to clipboard
$ bundle install
Ruby: Install the RubyGem.

You can parse MODL like this:

copy to clipboard
require = "modl" modl_string = "test(message=Hello World)" result = MODL.parse(modl_string)
Ruby: Interpret a MODL object.

Java

The Java interpreter is available on GitHub. Content on another site.

This library is a little behind the latest version and is due to be updated in the coming weeks. It doesn't include an API for accessing the MODL object yet but does provide the option of converting the MODL object to JSON – which can then be accessed using the Java JSON API. To convert MODL to JSON:

copy to clipboard
String input = "test(message=Hello World)"; String json = ConfigInterpreter.parseToJson(input);
Java: Convert the MODL input to JSON output.

The library also includes a useful HTTP wrapper.

Other Languages

We're still working on other libraries. In the meantime, you could use the Java http wrapper service. You'll need Java and Gradle. Content on another site.

Setting up the HTTP server

To install the Java library and start the HTTP server, run these commands in the directory of your choice:

copy to clipboard
git clone https://github.com/MODLanguage/java-interpreter cd java-interpreter ./gradlew run
Commands to clone the git repository from GitHub and start the server using Gradle.

Using the HTTP server

Once the server is running, you can submit data directly through the query string:
http://0.0.0.0:8080/?modl=test(message=this is a test message) Content on another site..

The server converts it to JSON.

Using the basic client

There's a very basic client available in the client folder of the project – open the client/index.html file in a web browser – you can use it to send MODL to the HTTP server.

If you're aware of a library that's not included on this page please let us know. If you're a developer and would like to develop a MODL library please get in touch, we'd love to hear from you. We can answer any questions you have about the specification. The best way to reach us is on Twitter Content on another site..