CLI
The nilakan command reads Nilakan source, runs it, prints program output to stdout, and prints
diagnostics to stderr. The installed nlk command is an alias with identical behavior.
nilakan [options] <file.nlk>nilakan [options] -nilakan [options] Read piped stdin when stdin is not a terminal.Replace nilakan with nlk in any invocation to use the short alias.
Inputs
Section titled “Inputs”| Form | Behavior |
| --------------------- | -------------------------------------------- |
| nilakan program.nlk | Reads a file. The path must end with .nlk. |
| nilakan - | Reads stdin. |
| piped stdin | Reads stdin when stdin is not a terminal. |
Options
Section titled “Options”| Option | Behavior |
| -------------------------- | -------------------------------------------------------------- |
| -h, --help | Print usage and exit successfully. |
| --max-rounds NUMBER | Override the global commit-round limit. |
| --max-call-depth NUMBER | Override the function call-depth limit. |
| --max-loop-depth NUMBER | Override the loop-depth limit. |
| --max-prime-depth NUMBER | Override the maximum source prime depth. |
| --string-quotes STYLE | Choose how strings are printed: double or single. |
| --color MODE | Control diagnostic color output: auto, always, or never. |
Numeric limits must be nonnegative safe integers from 0 through 9007199254740991. Decimal
fractions, exponent notation, negative values, and larger integer text are usage errors. Zero
prohibits the corresponding operation.
Default runtime limits:
| Option | Default |
| ------------------- | -------- |
| --max-rounds | 100000 |
| --max-call-depth | 100 |
| --max-loop-depth | 100 |
| --max-prime-depth | 5 |
Output
Section titled “Output”print(...) output is written to stdout. Diagnostics and usage errors are written to stderr.
When NO_COLOR is set in the environment, diagnostics are printed without color, even when color
mode is auto.
--string-quotes single changes printed string delimiters from double quotes to single quotes.
Containers and err(name, message, code) output use the same string quote style recursively.
--color always forces diagnostic color, --color never disables diagnostic color, and
--color auto uses terminal detection. NO_COLOR disables color when diagnostics are formatted.
Usage Errors
Section titled “Usage Errors”The CLI exits with code 2 for usage errors:
- unknown option
- missing option value
- invalid nonnegative integer option value
- more than one positional input
- file path not ending in
.nlk - no file argument while stdin is a terminal
File-system failures are not usage errors. A missing file, directory path, permission failure, or
other read error prints error: could not read '<path>': <reason> and exits with code 1.
Exit Codes
Section titled “Exit Codes”| Code | Meaning |
| ---- | ---------------------------------------------------------------- |
| 0 | Program ran successfully, or help was printed. |
| 1 | Nilakan syntax/static/runtime error, or input file read failure. |
| 2 | CLI usage error. |
Examples
Section titled “Examples”nilakan examples/hello.nlknilakan --string-quotes single examples/hello.nlknilakan --max-rounds 1000 examples/loop.nlkcat examples/hello.nlk | nilakan -Get-Content examples\hello.nlk | nilakan -type examples\hello.nlk | nilakan -