Skip to content

CASM Syntax ​

CASM source files use the .casm extension. Each file defines a module, and contains function declarations with instruction bodies. The file path determines the module name when CandleC builds a project; see CandleC projects.

Instructions ​

An instruction consists of a mnemonic followed by zero or more operands:

casm
<mnemonic> [operand [, operand ...]]

Operands may be separated by commas or whitespace. Commas are optional but recommended for readability. Instructions are line-oriented; a function declaration must end with a newline before its body begins. Blank lines are allowed between declarations and instructions.

Names and comments ​

Names are case-sensitive. Identifiers start with a Unicode alphabetic character or _; subsequent characters may also contain digits, ., and -. The words function, self, void, null, true, and false have special meaning in their respective syntax positions.

A # starts a comment that continues to the end of the line. It may appear at the start of a line or after source text, including after an instruction.

See Functions for declarations, Registers for register names, and Literals for values accepted as operands.

Built for the Candle ecosystem · Powered by VitePress.