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 https://www.oracle.com/technetwork/oracle-labs/program-languages/downloads
- Unpack the downloaded
graalvm_*.tar.gz
intosimplelanguage/graalvm
. - Verify that the file
simplelanguage/graalvm/bin/java
exists and is executable - Execute
mvn package
- Tested with Eclipse Mars SR2
- 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.1
- Open Netbeans
- File -> Open Project -> Select
simplelanguage
folder -> Open Project
- Tested with IntelliJ 2016.1.3 Community Edition
- Open IntelliJ IDEA
- File -> New -> Project from existing Sources -> Select
simplelanguage
folder -> Click next and keep everything default on several screens -> Finish
- Execute
./sl tests/HelloWorld.sl
to run a simple language source file. - Execute
./sl -disassemble 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 tests/SumPrint.sl
to dump graphs to IGV.
- Execute
./sl -debug tests/HelloWorld.sl
. - Attach a Java remote debugger (like Eclipse) on port 8000.
Simple language is compatible to:
- Truffle-Version: 0.28
- GraalVM-Version: 0.28
- Truffle JavaDoc
- Truffle on Github
- Graal on Github
- Truffle Tutorials and Presentations
- Truffle FAQ and Guidelines
- 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).