Compiler Pipeline
How Sanguis programs compile and run
Two Stages, One Command
Sanguis compiles in two stages. Both are invisible to the user:
.sanguis source → [bleed] → BloodCode (.bc) → [ad --target vulkan] → grid settles on GPU
The pipeline has two stages:
1. Compiler (bleed). Parses Sanguis source and emits BloodCode: a pipe-delimited text file containing the organ manifest (declared field layouts), named method blocks, and the program instructions.
2. Runtime (ad). Reads the BloodCode file and presses it into the VANA wiring grid: organs become field wires, methods become inlined subcircuits, and the whole structure settles on the GPU. The kernel is fixed; the program is data.
The user writes Sanguis source, runs two commands, and gets output. Both artifacts are readable text files.
sanguis bleed program.sanguis -o program.bc sanguis ad --target vulkan program.bc
.sanguis - Source
Human-written text file: organs with fields and methods, circuits with cells, variables, control flow, and comments (//). The primary source format.
.bc - BloodCode
Pipe-delimited text format produced by the compiler. It carries two things:
decl|Counter|1 <- declared organ layout field|count:float|0 <- field name and type block|main|0 <- a named block (the program body) pulse|_|10 <- push the constant 10 dispatch|new|1 <- inline the block `new` hold|c|0 <- store top of stack into `c` read_field|count|0 <- read an organ field output|_|0 <- emit end||0
The decl|/field| header is the organ manifest: the declared layout travels with the compiled program, so the .bc file runs without the source that produced it. Users can open and read .bc files; they are the portable artifact.