The first tool you can use to get started with Dyvil is it's official REPL (Read-Evaluate-Print-Loop). It allows you to enter any valid Dyvil expression and have it checked and evaluated by the program.

Installing and Launching the REPL

To use the REPL, you have to download the dyvil-X.Y.Z.jar file from any Dyvil Release Page, e.g. dyvil-0.40.0.jar.
After downloading the file, you can launch it using the java console command:
java -jar dyvil-0.40.0.jar
This will print text similar to the one shown in the above example. As soon as the > sign appears, the REPL has finished doing it's initialization and you may start typing.

Supported Language Elements

The REPL can process any Dyvil expression and statement, which you can learn about in the respective pages of this documentation.
Furthermore, it also supports these class- and header-level declarations:
> var i = 10
var i: int = 10
> var s = "abc"
var s: String = abc
> var tuple = (1, "a", false)
var tuple: (int, String, boolean) = (1, a, false)
> func add(i: int, j: int) = i + j
func add(i: int, j: int) -> int = i + j
> var result = add(1, 2)
var result: int = 3
> class Person {
var name: String
var age: int
class Person...
> interface Callable<T> {
func call() -> T
interface Callable...
> import java.util.Date
import ...
> using dyvil.math.MathUtils._
> using dyvil.Strings
> prefix operator ~~
> infix operator +- { precedence 150, associativity left }
> postfix operator !!
> type StringList = List<String>
> type ToIntMap<K> = Map<K, int>
> type NestedMap<K1, K2, V> = Map<K1, Map<K2, V>>


The REPL also supports internal REPL commands that are denoted by the :[commandname] [arguments...] syntax.
The following commands are predefined:
help, ?
Prints the available commands and their descriptions.
exit, shutdown
exit code
Exits the current REPL instance
exit 0
Prints information about the current REPL and Dyvil installation.
Sets the directory to which REPL Result class files (.class) are dumped.
dump ./replbin
Enables or disables debug mode
Prints all custom defined variables
Prints all custom defined methods
complete, c
Expression or Type
Displays available completions for the expression or type
c List(1, 2, 3).
It is not possible to define or use custom commands.

Multi-line Input

You usually submit input to the REPL by pressing the enter key. However, there are a few situations in which the enter key will not evaluate the expression, but insert a line break instead:
  • Unbalanced Parentheses
    When the parentheses or brackets in your input are not balanced, the REPL will insert line breaks. This will happen until all three types of brackets ((), [] and {}) are balanced:
    > class Person {
    var name: String
    var age: int
    class Person ...
    > [
    let res...
    Within curly brackets {}, your code will be automatically indented by one tab symbol per nesting level. Note that parentheses and brackets within String literals are excluded from the above rules and have no impact on the newlines inserted by the REPL.
  • Strings
    Unclosed single-quoted or double-quoted String literals also prevent the REPL from evaluating your expressions. This allows you to enter multi-line Strings without trouble:
    > "Hello
    let res...