CLI Reference
The scar command provides the compiler interface:
scar run <file.scar>
scar build <file.scar> [-o output]
scar version
scar helpscar run
Compile and immediately execute a source file:
scar run hello.scarThe 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-appWhen -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 versionscar help
Print command usage. The CLI also documents --help and -h as help aliases, and --version and -v as version aliases.
Exit codes
| Code | Meaning |
|---|---|
0 | Success. |
1 | Compilation error. |
2 | Usage error, such as invalid arguments. |
Compiler errors
Diagnostics include the source file, line, column, and message:
file.scar:LINE:COL: error: MESSAGEThis makes it straightforward to locate type mismatches, invalid calls, undefined names, and missing returns in an editor.