Antlr is used to perform parsing and the ASM bytecode manipulation framework is used for bytecode generation. The runtime environment performs all type checking and coercions as well as dynamic linking.
import javax.swing.JOptionPane
fun main() {
JOptionPane.showMessageDialog(null, "Hello World.")
}
Function calls can be deferred in a last in first out order. Parameters
are evaluated immediately and are stored until the deferred statement is executed.
fun main() {
for (i range 0 to 10) {
defer println(i)
}
defer println("World!")
defer print("Hello, ")
}
fun func(name, param) = when(name) {
"println" -> println(param)
"sin" -> Math.sin(param)
"cos" -> Math.cos(param)
"PI" -> Math.PI / param
else -> {}
}
fun main() {
println("Sin(PI) = " + func("cos", Math.PI))
}
go aFunction();
Many Raven tests are written in Raven and are compiled using the
raven-maven-plugin.
To achieve Junit compatibility we add an annotation processor for the
@Test annotation to ensure that test methods are compiled as non-static
void methods.
import org.junit.Assert
import org.junit.Test
@Test
fun testAddition() {
var a = 100
var b = 200
Assert.assertEquals(300, a + b)
}
Last modified 16 December 2024