Skip to content

Build programs

chelis build checks a program, emits C, and invokes the host's native toolchain to produce an executable. For example:

Terminal window
chelis build app.ch --output out/
./out/app

To generate the C sources without compiling them, use --emit-c:

Terminal window
chelis build app.ch --emit-c --output out/

--emit-c writes sources, headers, and runtime support and prints compile guidance. It does not require a native compiler or archiver. See build requirements for the system tools used by a normal build.

For app.ch and --output out/, the C build writes out/app.c and out/app.h. A program with observable results produces out/app. A module containing only callable definitions produces out/libapp.a instead. A static-library build does not create a process entry point.

The output directory also contains the bundled libchelis_runtime.a and public runtime headers, including chelis_runtime.h. Keep the generated header, module archive, and runtime artifacts from the same build together.

Set CHELIS_CC to choose a C compiler executable; otherwise Chelis selects an available platform compiler. Static libraries use CHELIS_AR or ar. Each override is one executable name or path, without embedded arguments. An invalid explicit override fails the build.

Chelis supplies the compile and link flags needed by its runtime and numerical rules. An ordinary build prints the selected compiler; --emit-c prints the commands needed to compile the emitted sources.

Include the generated header, such as out/app.h, and use the parameter and result types it declares for each exported function. Link out/libapp.a followed by out/libchelis_runtime.a, then the native dependencies printed under Link requirements (after module archive). Those dependencies depend on the platform and operations. For example, a GCC build using OpenMP needs -fopenmp when linking the caller as well.

Read the generated declarations before writing a caller: scalar, tuple, and tensor exports do not all have the same calling convention.

chelis check validates the program without building it. chelis eval --file app.ch runs a program through the evaluator. These commands serve different purposes: a program accepted by check may still use an operation that the C compiler cannot emit.

For the precise behavior of an operation, consult its language or library reference. Chelis reports unsupported build operations as errors rather than substituting a different calculation. The backend specification defines the artifact and native-build contracts.