danidiaz / triviallanguage

An even simpler version of Graal/Truffle's SimpleLanguage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TrivialLanguage

This is a simpler version of Truffle's SimpleLanguage, showcasing fewer of Truffle's capabilities.

It is intended to show the absolute basics of Truffle.

Differences with SimpleLanguage

  • Only string and int literals allowed.
    • No bools
    • No function literals.
    • No nulls.
  • No suport for objects.
  • Sum (+) is the only binary operation (works on both Strings and Ints, like in SimpleLanguage).
  • No suport for local variables other than function arguments.
  • Function definitions are only allowed at the top level.
  • Functions can't be redefined.
    • This makes TLFunction a bit simpler than SLFunction.
      • It receives the RootNode in the constructor itself.
  • Function bodies can only consist of single expressions.
    • There aren't any statements or looping constructs.
    • We don't have to catch control flow exceptions thrown by return nodes.

About

An even simpler version of Graal/Truffle's SimpleLanguage

License:Universal Permissive License v1.0


Languages

Language:Java 92.2%Language:Shell 7.8%