BlyxDocumentation
Browse chapters
Documentation / Language reference

Command-line reference

Look up CLI forms, output files, execution budgets and exit codes.

Command forms

Pass the entry file to each command. Native builds and native-run also load its local imports. Quote any path containing spaces as required by your shell.

CommandEffect
blyxc --version or -VPrint the installed compiler version.
blyxc help, --help or -hShow the available commands.
blyxc new NAMECreate a new directory with Blyx.toml and src/main.blyx.
blyxc check FILEParse the file and report syntax diagnostics.
blyxc run FILE [--max-steps N]Interpret main with an optional positive step budget.
blyxc build FILE [-o PATH]Build a native executable, optionally at PATH.
blyxc native-run FILE [-- ARGS...]Build the native project, run it and forward the program arguments.
blyxc fmt FILERewrite the file with normalized line endings.

Interpret the exit status

Capture the exit status immediately following the command. In PowerShell read $LASTEXITCODE. In a POSIX shell read $?. Scripts can use the status to decide whether to proceed. The exit codes below describe blyxc itself.

CodeMeaning
0Command completed successfully.
1Examples include a missing file, parser error or failed build.
2Examples include an unknown command, a missing argument or an invalid run budget.
4The interpreter reached a runtime failure, such as integer division by zero.

Find the output file

With no -o option a native build puts the executable beside the source, using the platform executable extension. Pass an explicit output name when a project has several programs or when a script needs to invoke a known path.

Separate execution budgets

--max-steps controls a CLI interpreter run. The browser and the VS Code worker also enforce source, output and time limits. A native executable has ordinary process and system limits. These modes can differ for a very long or deeply recursive computation.

Practice

Choose the commands for a script that first checks the syntax of main.blyx, then runs it with a budget of 500 steps.

Hint

Check the exit status before starting the second command.

Worked solution

Use blyxc check main.blyx, followed on success by blyxc run main.blyx --max-steps 500. A parser success does not guarantee that execution will finish within the budget.