Skip to content

Attempt to run Elm code on GraalVM using the Truffle API

License

Notifications You must be signed in to change notification settings

sgdan/truffle-elm

Repository files navigation

truffle-elm

Attempts to run Elm code on GraalVM using the Truffle API.

Elm code is compiled by the elm-in-elm compiler to an intermediate format where the optimised AST nodes are specified in JSON. See test.json for an example.

Build and Run

Uses the GraalVM docker image with gradle installed to build and run. A native executable can also be produced using the graal native-image tool.

Note: If you want to run the gradle commands directly, you can use make shell run the docker container. See the Makefile for gradle arguments.

Currently the result is rather trivial, it just executes the code in test.json which produces the output 12. To run via make and docker-compose:

# build and run
make run

# execute unit tests
make test

# create and run linux native executable
make build-native # produces build/grelmnative (25M)
make run-native

The AST in test.json was compiled from this Elm code:

module Main exposing (main)


double =
    \x -> x + x


inc =
    \a -> a + 1


main =
    double (inc 5)

About

Attempt to run Elm code on GraalVM using the Truffle API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published