Documentation menu
Compiler

The omegyu command

The commands and options of omegyu, the command-line tool that checks, normalises, runs and formats Omegyu programs and compiles contracts.

Find a section7 sections

omegyu checks, normalises, runs and formats Omegyu programs, and compiles contracts to EVM bytecode. In a checkout of the repository, nix develop provides the tools and just build builds everything. nix run . -- --help runs the executable, and nix build builds it and runs its tests.

Commands

CommandWhat it does
omegyu typeprints the type of an expression
omegyu normalizeprints the normal form of an expression
omegyu elaborateprints the kernel term that an expression elaborates to, with everything that was inferred
omegyu runruns a program: an expression of type IO a
omegyu parseprints the syntax tree of an expression
omegyu formatformats source files
omegyu highlightprints a source with syntax highlighting
omegyu freezepins the imports of files to the hashes of what they check to
omegyu replevaluates expressions interactively
omegyu evm buildcompiles a contract to EVM bytecode
omegyu evm planprints a measured deployment plan, without sending transactions

type, normalize, elaborate, run, parse and highlight read a file, the standard input when the file is - or missing, or an expression given with -e or --expr:

$ omegyu type -e '\(n : Natural) -> n + 1'
Natural -> Natural
$ omegyu normalize -e 'std:List.map (\(n : Natural) -> n + 1) [ 1, 2, 3 ]'
[ 2, 3, 4 ]

omegyu run FILE ARGS… gives the arguments after -- to the program, which reads them with IO/args:

$ omegyu run examples/fizzbuzz.omg -- 5
1
2
Fizz
4
Buzz

Options

Every command accepts these options:

OptionEffect
--color WHENcolours the output: auto, the default, colours it on a terminal unless NO_COLOR is set; always and never decide for it
--unicodeprints code with the Unicode symbols, such as λ, → and ∀
--width COLUMNSlays out code for lines of this width; the default is 100
--no-cacheneither reads nor writes the cache of checked modules; OMEGYU_CACHE=off does the same
--recheckhas the kernel check again what is read from the cache

omegyu --version prints the version, and --help after a command prints its options.

Formatting

omegyu format FILES… prints each file formatted, or the standard input when no file is given. -i or --inplace rewrites the files instead, and --check prints no source and fails when a file is not formatted. --unicode writes the Unicode symbols.

$ omegyu format -e 'let x   = 1 in x'
let x = 1 in x
$ omegyu format --check messy.omg
error: messy.omg: not formatted

Freezing imports

omegyu freeze FILES… writes after each import the hash of the module that it checks to, and updates the hashes that changed. --check changes nothing, and fails when an import is not pinned to the hash of what it checks to. Imports and the cache describes hashes.

The REPL

omegyu repl reads expressions and definitions:

InputEffect
an expressionevaluates it, and carries it out when it is an action
let x = edefines x for the rest of the session
:type e, :t eprints the type of e
:resetforgets the definitions of the session
:help, :h, :?prints the commands
:quit, :q, Ctrl-Dleaves

Each input is checked as the program made of it and of the definitions that it refers to. Tab after a dot completes the fields of a record and the constructors of a union.

Contracts

omegyu evm build FILE compiles a contract, and omegyu evm plan FILE prints its deployment plan. The EVM back end describes them and their options.

Exit status and environment

omegyu exits with 0 when the command succeeds, and with 1 when it fails, after printing the diagnostics on the standard error. omegyu run exits with the status that the program gives to IO/exit.

VariableEffect
OMEGYU_CACHEthe directory of the cache, or off to turn it off
XDG_CACHE_HOMEwhen OMEGYU_CACHE is not set, the cache is in omegyu under this directory, by default ~/.cache
NO_COLORturns colours off under --color auto