Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

xq asm

Assemble an XQVM assembly source file into binary bytecode.

Usage

xq asm <INPUT> [-o <OUTPUT>] [--stdout]

Arguments

ArgumentDescription
INPUTPath to the assembly source file (.xqasm).

Options

OptionDescription
-o, --output <FILE>Output file path. Defaults to <INPUT>.xqb when omitted.
--stdoutWrite bytecode to stdout instead of a file. Conflicts with -o.

Examples

# Assemble to default output (program.xqb)
xq asm program.xqasm

# Assemble to a specific output file
xq asm program.xqasm -o build/program.xqb

# Pipe bytecode to another tool
xq asm program.xqasm --stdout | xq dism

Output

On success, prints a summary to stderr:

assembled 12 instructions (28 bytes) -> program.xqb

Error Reporting

Assembly errors include source file location and a highlighted snippet:

Error: unknown mnemonic
  ┌─ program.xqasm:3:1
  │
3 │ BADOP r0
  │ ^^^^^ unknown instruction