Source

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.

Examples

Interoperability

import javax.swing.JOptionPane

fun main() {
    JOptionPane.showMessageDialog(null, "Hello World.")
}

Defer

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, ")
}

When

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 routines

go aFunction();

View more examples

Tests

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.

Example

import org.junit.Assert
import org.junit.Test

@Test
fun testAddition() {
    var a = 100
    var b = 200
    Assert.assertEquals(300, a + b)
}


Tags: language   jvm  

Last modified 02 August 2021