The hextruffle mini language

I realized today that with the nodes I have, with each being a meaty operation, I could never truly see what Truffle and Graal are capable of. For this reason, I’m implementing a miniature programming language without a parser. All programs are made through a series of invocations of Java constructors for various node classes. […]

Read more "The hextruffle mini language"

Replacing nodes

This post will cover a powerful feature of Truffle, which allows one to replace a node dynamically with a different node. This is extremely useful if you have a node that will start in one state and rarely change. That node’s state should be a static field to allow the JIT to aggressively optimize it […]

Read more "Replacing nodes"

Child nodes in arrays

Often, it is necessary for a dynamic number of children to be present in a node (e.g. a block of code with multiple operations, or an array initializer in the guest language). This can be done with arrays, for which the code is fairly straightforward: package com.wordpress.hextruffle.tests; import; import; import; import; […]

Read more "Child nodes in arrays"

Child nodes

Of course, any language would be practically useless if all that was available to you was a single hardwired root node. For this reason, Truffle allows for child nodes. Their uses include: Multiple statements in a program or block Evaluation of arguments Operators (e.g. 2+2) Here, I’ll create a root node that has two child […]

Read more "Child nodes"