cromo The Cromo Guide
PDF IT

Appendix B: The cromo command

cromo is the only tool of Cromo: the compiler, the linker, the test runner, the formatter and the language server, in one executable.

cromo <command> [options] [file.cro] [-- arguments]

Without a file, the commands use main.cro of the current folder.

#Commands

CommandDoes
cromo build [file.cro]compiles the program into an executable
cromo run [file.cro] [-- arguments]compiles the program into a temporary folder, runs it with the arguments that follow --, and ends with its exit code
cromo test [file.cro] [names]runs the [[test]] functions of the program and of its modules; the names choose the tests that contain them
cromo fmt [--check] [files and folders | -]formats the code, by default of the current folder and its subfolders; --check only lists the files to format; - formats the standard input
cromo lspthe language server, for editors, on the standard input and output
cromo versionprints the version of cromo and of LLVM
cromo helpprints the commands

#Options of build and run

OptionMeaning
-o <file>the name of the executable; by default the name of the source, or of the folder without a file, with .exe for Windows
--releaseintegers wrap around on overflow, instead of stopping the program
--target windows, --target linuxthe system of the executable; by default the one cromo runs on
-O0 … -O3the level of optimization; the default is -O2
--emit-irprints the LLVM IR of the program instead of writing the executable

#Debug and release

Debug (default)--release
Optimization-O2-O2
Integer overflowpanicwraps around
Bounds, division by zero, exclusivitycheckedchecked
Stack tracesyesyes
Information for a debuggeryes: PDB on Windows, DWARF on Linuxno

With -O0 a debugger shows every variable; with the optimizations, some can be optimized out.

#Exit codes

CodeMeaning
0the program ended normally, or main returned 0
1an exception left main; or cromo found errors
101a panic, or a stack overflow
otherthe value returned by main, or given to os.exit

#Files

PathContent
~/.cromo/current/bin/cromothe active version, which the PATH reaches
~/.cromo/versions/<version>the installed versions
lib/ next to bin/the standard library and the runtime, which cromo reads

On Windows, ~ is %USERPROFILE%.