A simple demonstration language built using Truffle for the GraalVM.
SimpleLanguage is heavily documented to explain the how and why of writing a Truffle language. A good way to read this documentation is to generate HTML of the JavaDoc comments and read that, and then read the source alongside the comments.
This repository is licensed under the permissive UPL licence. Fork it to begin your own Truffle language.
- JDK 8
- maven3
- Clone SL repository using
git clone https://github.com/graalvm/simplelanguage
- Download Graal VM Development Kit from http://www.oracle.com/technetwork/oracle-labs/program-languages/downloads
- Unpack the downloaded
graalvm_*.tar.gz
intosimplelanguage/graalvm
(note: no version in folder name). - Set environment variable
JAVA_HOME
to the path of thegraalvm
folder (note: mac users should setJAVA_HOME
to/path/to/graalvm/Contents/Home
) - Verify that the file
$JAVA_HOME/bin/java
exists and is executable - Execute
mvn package
- Tested with Eclipse Neon.2 Release (4.6.2)
- Open Eclipse with a new workspace
- Install
m2e
andm2e-apt
plugins from the Eclipse marketplace (Help -> Eclipse Marketplace...) - File -> Import... -> Existing Maven Projects -> Select
simplelanguage
folder -> Finish
- Tested with Netbeans 8.2
- Open Netbeans
- File -> Open Project -> Select
simplelanguage
folder -> Check "Open Required Projects:" -> Open Project
- Tested with IntelliJ IDEA 2016.3.4
- Open IntelliJ IDEA
- File -> New -> Project from existing Sources -> Select
simplelanguage
folder -> Check "Create module groups for multi-module Maven projects" -> Finish
- Execute
./sl language/tests/HelloWorld.sl
to run a simple language source file. - Execute
./sl -disassemble language/tests/SumPrint.sl
to see assembly code for Truffle compiled functions.
- Download the Ideal Graph Visualizer (IGV) from https://lafo.ssw.uni-linz.ac.at/pub/idealgraphvisualizer/
- Unpack the downloaded
.zip
file - Execute
bin/idealgraphvsiualizer
to start IGV - Execute
./sl -dump language/tests/SumPrint.sl
to dump graphs to IGV.
- Execute
./sl -debug language/tests/HelloWorld.sl
. - Attach a Java remote debugger (like Eclipse) on port 8000.
Simple language is compatible to:
- Truffle-Version: 0.33
- GraalVM-Version: 0.33
- Truffle JavaDoc
- Truffle on Github
- Graal on Github
- Truffle Tutorials and Presentations
- Graal VM on the Oracle Technology Network
- Papers on Truffle
- Papers on Graal
The Truffle framework is licensed under the GPL 2 with Classpath exception. The SimpleLanguage is licensed under the Universal Permissive License (UPL).