Skip to content

CLI Commands

Complete reference for all nicc commands and options.

Global Options

These options work with any command:

bash
nicc --version    # Print version info
nicc --help       # Show help
nicc -h           # Show help (short form)

nicc build

Build a project from nic.toml:

bash
nicc build [OPTIONS]

Options

OptionDescription
-o, --output FILEOutput file (default: project name)
--releaseBuild with optimizations
-a, --astShow parsed AST
-s, --sastShow typed AST (SAST)
-vIncrease SAST verbosity (use with --sast)
-l, --llvmShow LLVM IR
-d, --debugEnable parser tracing
--trace-log FILEWrite parser trace to file
--error-format FORMATError output format: pretty or json
--no-colorDisable colored output

Examples

bash
# Basic build
nicc build

# Build with custom output name
nicc build -o myprogram

# Release build with optimizations
nicc build --release

# Inspect generated LLVM IR
nicc build --llvm

# Debug build with detailed type info
nicc build --sast -vv

nicc run

Build and run a project or file:

bash
nicc run [OPTIONS] [FILE] [-- ARGS...]

Options

OptionDescription
-b, --buildCompile to binary (default: JIT)
-k, --keepKeep compiled binary after execution
--releaseBuild with optimizations
All inspection options from build--ast, --sast, etc.

Modes

JIT Mode (default): Compiles to memory and executes immediately. Fastest for development.

bash
nicc run                  # Run project
nicc run file.nic         # Run single file
nicc run -- arg1 arg2     # Pass arguments to program

Native Mode: Compiles to a binary, then executes it.

bash
nicc run --build              # Compile and run
nicc run --build --keep       # Keep the binary afterward
nicc run --build --release    # Optimized native compilation

Examples

bash
# Run project with arguments
nicc run -- --verbose input.txt

# Run single file, show LLVM IR
nicc run --llvm test.nic

# Compile and keep binary for profiling
nicc run --build --keep --release

nicc new

Create a new project:

bash
nicc new <NAME> [OPTIONS]

Options

OptionDescription
--path PATHProject directory (default: ./<name>)

Generated Files

bash
nicc new myproject

Creates:

myproject/
├── nic.toml      # Project manifest
└── src/
    └── main.nic  # Entry point

Example nic.toml

toml
[project]
name = "myproject"
version = "0.1.0"

[paths]
src = "src/"

[prelude]
enabled = true

nicc init

Initialize a project in the current directory:

bash
nicc init

Creates nic.toml and src/main.nic if they don't exist. Useful for adding Nic to an existing directory.

nicc lsp

Start the Language Server Protocol server:

bash
nicc lsp [OPTIONS]

Options

OptionDescription
--log FILELog file for debugging

The LSP server communicates via stdin/stdout and is typically started by your editor automatically. See Editor Support (LSP) for setup instructions.

nicc bindgen

Generate Nic bindings from C header files:

bash
nicc bindgen <HEADER> [OPTIONS]

Options

OptionDescription
-o FILEOutput file (default: stdout)
-I PATHInclude path for clang (repeatable)

Examples

bash
# Generate bindings to stdout
nicc bindgen mylib.h

# Generate to file with include paths
nicc bindgen sqlite3.h -o sqlite3.nic -I/usr/include

# Multiple include paths
nicc bindgen raylib.h -I/opt/raylib/include -I/usr/local/include

See C Bindings (bindgen) for details on type mappings and usage.

Single-File Mode (Legacy)

Compile a single file without a project:

bash
nicc [OPTIONS] <FILE>

Options

OptionDescription
-a, --astPrint parsed AST
-s, --sastPrint typed SAST
-vIncrease SAST verbosity
-l, --llvmPrint generated LLVM IR
-c, --compileCompile to executable
-o FILEOutput file (default: a.out)
-d, --debugEnable parser tracing
--trace-log FILEParser trace output file
--error-format FORMATpretty or json
--no-colorDisable colors

Examples

bash
# Show AST
nicc --ast hello.nic

# Show typed AST with full type annotations
nicc --sast -vv hello.nic

# Compile to executable
nicc -c -o hello hello.nic
./hello

# Debug parser issues
nicc --debug --trace-log trace.txt --ast broken.nic

Exit Codes

CodeMeaning
0Success
1Compilation error (parse, type, or codegen)
OtherRuntime error from executed program

See Also

Released under the MIT License.