CLI Reference

The scar command provides the compiler interface:

scar run <file.scar> scar build <file.scar> [-o output] scar version scar help

scar run

Compile and immediately execute a source file:

scar run hello.scar

The command uses a temporary directory for generated Go source and invokes Go to run it. A Go toolchain must be available on PATH.

scar build

Compile a source file into a native executable:

scar build hello.scar scar build hello.scar -o my-app

When -o is omitted, the output name is derived from the source file. Use an .exe suffix for a Windows executable. Go is required on the machine doing the build. The resulting binary can run without the ScarScript compiler or Go installed on the target machine of the same platform and architecture.

scar version

Print the installed compiler version:

scar version

scar help

Print command usage. The CLI also documents --help and -h as help aliases, and --version and -v as version aliases.

Exit codes

CodeMeaning
0Success.
1Compilation error.
2Usage error, such as invalid arguments.

Compiler errors

Diagnostics include the source file, line, column, and message:

file.scar:LINE:COL: error: MESSAGE

This makes it straightforward to locate type mismatches, invalid calls, undefined names, and missing returns in an editor.