LogoChemical Docs
Ctrl+K

CLI Reference

The chemical command-line tool is a versatile entry point for compilation, translation, and project management.

Project Setup

configure

Configures the compiler for the current OS. It sets CHEMICAL_HOME and adds the compiler to the system PATH.

chemical configure

Compilation Basics

Single File Compilation

chemical main.ch -o main.exe

Options

Output Modes (--mode or -m)

Chemical supports several pre-configured compilation modes:

Mode Description
debug Standard debug build (default).
debug_quick Fast compilation, minimal optimizations.
debug_complete Full debug info, exhaustive checks.
release_fast Optimized for execution speed.
release_small Optimized for binary size.
chemical main.ch -m release_fast -o production_app

Build System & Modules

Building a Project

Running a .lab or .mod file triggers the build system.

chemical build.lab

Arguments for build.lab

You can pass custom arguments to your build scripts using the --arg- prefix.

chemical build.lab --arg-target=wasm

Module Management

Intermediate Artifacts

You can output specific compilation stages:

JIT Execution

Run Chemical code immediately without permanent binary generation.

chemical --jit main.ch

Toolchain Wrappers

Chemical acts as a driver for several underlying tools:

Examples:

chemical cc main.c -o main.o

chemical ar rc libtest.a test1.o test2.o

Other Flags