Skip to main content

The esquec CLI

esquec is the entire toolchain. It is a single static binary built with go build ./cmd/esquec.

Subcommands

CommandEffect
esquec build foo.esq -o fooCompile and link to ELF executable.
esquec check foo.esqType-check only, no codegen.

The flags listed below apply to build. check accepts only the positional source file.

Flags

FlagEffect
-o PATHOutput path for the executable or .o file.
--emit=astStop after parsing; print the AST.
--emit=ceirStop after CEIR; print the core IR.
--emit=mirStop after MIR.
--emit=asmPrint hex of emitted machine code per fn.
--emit=objStop at the relocatable object; output is .o.
--keep-objKeep the intermediate .o next to the executable.

Examples

Type-check without building:

./esquec check examples/02_functions.esq

Look at the AST:

./esquec build examples/02_functions.esq --emit=ast

Look at the core IR (this is the most informative dump for most debugging):

./esquec build examples/02_functions.esq --emit=ceir

Look at machine code:

./esquec build examples/02_functions.esq --emit=asm
# Or, for a real disassembly:
./esquec build examples/02_functions.esq --emit=obj -o /tmp/sq.o
objdump -d /tmp/sq.o

Project layout

esque does not yet have a notion of multi-file projects; you compile one .esq at a time. Multi-module support is on the roadmap.

Linking

esquec invokes the system ld with -e _start once it has written the relocatable object. There is no runtime archive; the _start stub is emitted directly into the user's .o. The only external dependency at runtime is the kernel's syscall ABI.