Compiler Pipeline

How Sanguis programs compile and run

Two Stages, One Command

Sanguis compiles in two stages. Both are invisible to the user:

.sang source → [compiler] → .vana connectome → [runtime] → GPU execution

1. Compiler. Parses .sang source and emits a .vana connectome, a pipe-delimited description of neurons, connections, gates, and text holds.

2. Runtime. Reads the .vana connectome and runs the organism on the GPU. Neurons map to CUDA threads, connections to memory reads, gates to parallel activation checks.

The user writes .sang, runs one command, and gets output. The compiler and runtime are implementation details.

sanguis_run.bat program.sang [ticks]

File Formats

.sang - Source

Human-written text file containing circuit declarations, holds, routes, conditions, emits, appends, throughs, and wires. Comments with //. The primary source format.

.vana - Connectome

Pipe-delimited text format produced by the compiler. Each line is a record describing part of the organism:

VANA|v1
NEURON|index|name
CONN|from|to|weight|gate_idx|expr_idx
GATE|neuron_idx|cond_count|cond_lhs|cond_op|cond_rhs|...
EMIT|neuron_idx|value|target_type|target_name|is_string|is_append
EXPR|index|lhs|op|rhs|result_hold
TEXT|name|value
ENDBODY

Users do not normally inspect .vana files. They are intermediate output, cleaned up after execution.