Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

CLI

Elara has a command line interface (CLI) to build and run Elara programs. The CLI is invoked using the elara command followed by various options and flags.

With Cabal When running with Cabal in Development Mode, you should instead use cabal run elara -- [options] to interact with the CLI.

Subcommands

  • build Compiles the Elara source code.
This command is currently useless and will do nothing.
  • run Compiles and runs the Elara source code

By default, this runs in interpreted mode. You can use --target jvm to compile to JVM bytecode instead. For example, elara run source.elr --target jvm

Dumping

The compiler can intermediate representations of the code during compilation for debugging and development purposes.

You can enable this using the --dump flag followed by a comma-separated list of targets to dump. The available dump targets are:

Dump TargetDescription
lexedDumps a list of tokens after lexing
parsedDumps the Frontend AST after parsing
desugaredDumps the Desugared AST after desugaring
renamedDumps the Renamed AST after renaming
shuntedDumps the Shunted AST after shunting
typedDumps the Typed AST after type checking
coreDumps all stages of the Core language
irDumps the JVM bytecode IR representation (only works when running with --target jvm)
jvmDumps the generated JVM bytecode representation from H2JVM (only works when running with --target jvm)

All dumps are written to the build/ directory in the current working directory.