Trying ideas in the REPL
Run ablac repl, enter a function declaration, then an expression that calls it. The session keeps definitions. :help lists commands, :reset clears the session, and :quit ends it. Entries continue across lines while a bracket is open. The equivalent complete program below prints the same answer.
Session input is a real fixture too:
fun twice(n: int): int = n * 2
twice(21)
:quit
The function definition answers defined, the expression answers 42, and each prompt is abla> . tools/test-tour.sh checks that session's full stdout and exit status. See the toolchain reference for the REPL's platform behavior. To continue, use the language reference and stdlib module index to explore an API you need.
Load declarations from a file
The live REPL on x86-64 Linux and macOS supports :load <file>. A load adds the file's declarations. If the file defines main, the session exposes it as loadedMain() for you to call. A failed load leaves your session as it was. From the repository root, load the helper from the modules chapter and call it:
:load tests/cases/tour/pricing.ab
withTax(200, 20)
:quit
The call outputs 240.
import "abla/io"
fun twice(n: int): int = n * 2
fun main {
println("${twice(21)}")
}
// output:
// 42
Built from compiler source ba5d6b7d. Examples and generated signatures follow that source revision.