W# 0.1.1

The wsharp command

run, check and build, what --emit prints, and every environment variable.

wsharp run   <file.ws> [-- args]   # compile in memory and run main
wsharp check <file.ws>             # type-check only
wsharp build <file.ws> -o <prog>   # compile to a native executable

run

Compiles into memory and runs there, which is what you want while writing something. The process exits with the low byte of main’s return value.

Anything after -- belongs to your program and reaches it through os.args():

wsharp run prog.ws -- one two      # os.args() is ["one", "two"]

--gc-stress collects at every allocation and validates every root the stack maps describe. It is slow and it is the fastest way to find a collector bug in your own code.

check

Type-checks and stops. It does not monomorphise, which is why it can accept a program run rejects when a generic call’s type variable is never pinned. See limitations.

build

Writes a real program. The collector, the workers, TLS and the rest of the runtime are linked into it, and it needs no compiler on the machine that runs it.

wsharp build hello.ws -o hello
wsharp build --module ingot/main -o ingot     # root at a library module instead

Linking is done by $CC, or cc, against a runtime archive that wsharp looks for beside itself and under ../lib. An installation is a directory rather than a single file for that reason. The archive is libwsharp_start.a, or wsharp_start.lib where MSVC named it; both spellings are looked for, because cargo names a staticlib after the platform rather than after the crate.

--emit=obj stops at the relocatable object, which is the half that needs no C compiler.

–emit

Stops after a stage and prints it. The fastest way to see what the compiler is thinking.

tokensthe lexer’s output
astthe parsed syntax tree
typesone line per top-level function, so an overload set is several
hirtyped, monomorphised IR
clifgenerated Cranelift IR
objthe relocatable object, build only
wsharp check examples/inference.ws --emit=types
add: fn(i64, i64) i64
scale: fn(f64) f64
id: fn(T) T
first: fn(T, U) T
main: fn() i64

Exit codes

0 to 255the low byte of what main returned
1a compile error
101a W# panic, printed as W# panic: <reason> on stderr

return 256; exits 0, as a C program does.

Environment

WSHARP_GC_STATS=1print collector statistics on exit, including the number of pauses and the longest
WSHARP_GC_TRACE=1print every frame the root walk visits
WSHARP_GC_STRESS=1collect at every allocation, as --gc-stress does
WSHARP_RUNTIME_LIBthe runtime archive build links against
WSHARP_HOMEingot’s package store, ~/.wsharp by default
INGOT_REGISTRYa registry directory or git URL

All three collector variables are off when unset, empty or 0.

SHARPIE_HOME is a different variable belonging to a different program. See toolchains.

Last changed 8 September 2026. Improve this page

On this page