corfli
Contents

Start

Language

Project

The corfli tool

One program does everything: it checks your code, writes the machine code and puts the executable together. There is no separate assembler or linker, and nothing else to install.

Usage: corfli <command> [options] [file]

Commands:
  new <name>    Create a new project
  build         Build the program
  run           Build and run the program
  check         Check for errors without building
  clean         Remove the out folder

Options:
  -d, --debug       Debug build
  -w, --windows     Build a Windows .exe
  -l, --linux       Build a Linux executable
  -o, --out <path>  Output file
  -h, --help        Print help
  -V, --version     Print version

Projects

A project is a folder with a corfli.toml and a src/main.cfl:

[project]
name = "hello"
version = "0.1.0"

Run corfli anywhere inside the folder. It looks for corfli.toml in the current folder and the folders above it. The program starts at src/main.cfl; other files come in with include.

Builds go to out/:

commandoutput
corfli buildout/hello
corfli build -dout/debug/hello
corfli build -wout/hello.exe

corfli build file.cfl builds a single file instead, into out/ next to it.

Release and debug

corfli build makes a release build. Add -d for a debug build.

releasedebug (-d)
optimizeronoff, so it builds faster
number overflowwraps aroundstops with file and line
dividing by zerostops with file and linestops with file and line
a conversion that doesn't fitstops with file and linestops with file and line

See Errors for what these messages look like.

Windows programs

-w builds a Windows .exe from Linux. Nothing extra is needed: the compiler writes the Windows file format itself.

$ corfli build -w
  compiling hello (release, windows)
   -> out/hello.exe  1024 bytes  (0.00s)

Copy out/hello.exe to a 64-bit Windows PC and run it from a terminal. It uses only kernel32.dll, which every Windows has.

corfli run -w doesn't work on Linux, since a Windows program can't run there.

Exit codes

corfli build and corfli check exit with 1 when the code has errors. corfli run exits with whatever code the program ends with.