Skip to content
/ uri Public
forked from graalvm/simplelanguage

A simple example language built using the Truffle API.

License

Notifications You must be signed in to change notification settings

nbyouri/uri

 
 

Repository files navigation

SimpleLanguage

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.

Prerequisites

  • JDK 8
  • maven3

Installation

  • 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 into simplelanguage/graalvm (note: no version in folder name).
  • Set environment variable JAVA_HOME to the path of the graalvm folder (note: mac users should set JAVA_HOME to /path/to/graalvm/Contents/Home)
  • Verify that the file $JAVA_HOME/bin/java exists and is executable
  • Execute mvn package

IDE Setup

Eclipse

  • Tested with Eclipse Neon.2 Release (4.6.2)
  • Open Eclipse with a new workspace
  • Install m2e and m2e-apt plugins from the Eclipse marketplace (Help -> Eclipse Marketplace...)
  • File -> Import... -> Existing Maven Projects -> Select simplelanguage folder -> Finish

Netbeans

  • Tested with Netbeans 8.2
  • Open Netbeans
  • File -> Open Project -> Select simplelanguage folder -> Check "Open Required Projects:" -> Open Project

IntelliJ IDEA

  • 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

Running

  • 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.

IGV

Debugging

  • Execute ./sl -debug tests/HelloWorld.sl.
  • Attach a Java remote debugger (like Eclipse) on port 8000.

Tested Compatibility

Simple language is compatible to:

  • Truffle-Version: 0.32
  • GraalVM-Version: 0.32

Further information

License

The Truffle framework is licensed under the GPL 2 with Classpath exception. The SimpleLanguage is licensed under the Universal Permissive License (UPL).

About

A simple example language built using the Truffle API.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 97.2%
  • Slash 1.8%
  • Other 1.0%