Pelago

Command line

Every pelago command and its options.

pelago <command> [options] [path]

A path is a .pel file or a folder. With a folder, all the files in it are compiled as one package, so they can import each other.

Everyday commands

CommandWhat it does
pelago check <path>Parse, resolve names and check types. Prints the errors and a summary such as 18 modules, 1856 definitions, 0 errors.
pelago run <path>Build machine code in memory and run main.
pelago build [-o out] <path>Write a native executable.
pelago fmt [--check] <path>...Format source files. See Formatter.
pelago lspRun the language server on standard input and output. See Language server.

run

OptionEffect
--no-optSkip optimisation.
--interpRun in the IR interpreter instead of native code.
--optWith --interp: optimise the IR first.
--statsPrint IR statistics; with --interp, also the number of steps taken.
--leak-checkReport allocations that are still live at the end.
--timingsPrint the time each compiler phase took.

run ends with the exit status of your program. A compile error ends it with status 1.

build

OptionEffect
-o <file>Output file name.
--no-optDo not optimise.
--target=linux, --target=windowsOperating system of the executable.
--arch=aarch64Build for 64-bit ARM (Linux and Windows). The default is x86-64.
--leak-checkBuild with allocation counting; the program exits with status 3 and reports leaked N allocation(s) if memory remains.
--stats, --timingsCompiler diagnostics.

See Targets.

Looking inside the compiler

CommandOutput
pelago ir <path>Check the program, lower it to the intermediate representation, verify it and print it.
pelago parse <file>The syntax tree. - reads standard input.
pelago lex <file>The tokens. - reads standard input.
pelago keywordsThe hard and soft keywords.
pelago tokensThe operators and punctuation.
pelago highlight <file>Colour a file: --ansi, --html, --html-page or --plain, with --theme dark or --theme light.
pelago grammarThe TextMate grammar used by editors.

Exit status

StatusMeaning
0Success.
1A compile error, or the program stopped (stopped: ...).
2Bad usage or a broken configuration file; or the status your program passed to os.exit.
3--leak-check found a leak.

On this page