Overview

The sbbe command-line tool wraps the library for everyday use: assembling text to IR, running programs through the VM, emitting native code, and inspecting IR files.

sbbe <command> [options] <file...>

Commands

sbbe build

Compile .sbbe files to native code or another backend target.

sbbe build --target x86_64 -o output.s input.sbbe
sbbe build --target llvm -o output.ll input.sbbe
sbbe build --target c -o output.c input.sbbe

Not yet implemented.

sbbe run

Execute .sbbe files directly in the VM interpreter.

sbbe run program.sbbe

Not yet implemented.

sbbe print

Parse a .sbbe file and print it back in canonical form. Useful for verifying round-trip correctness and normalizing whitespace/formatting.

sbbe print input.sbbe

sbbe inspect

Show a summary of an IR file’s contents: function count, global count, constant table size, source file mappings, and function signatures.

sbbe inspect input.sbbe

Example output:

unit: input.sbbe
sources: 1
  0: src/main.c
constants: 3
globals: 1
  var $counter i32 (mutable)
functions: 2
  func $add(i32, i32) -> i32  [12 instructions, 2 blocks]
  func $main() -> i32         [8 instructions, 1 block]

Not yet implemented.

sbbe dump

Dump the full internal contents of an IR file, including the constant table with indices, raw instruction encoding, and block ranges. Intended for debugging the IR itself rather than the program it represents.

sbbe dump input.sbbe

Example output:

constants:
  $0: i32 = 42
  $1: f64 = 3.14
  $2: i32 = 1000000

globals:
  $counter: i32 (mutable, init = $0)

func $add(i32, i32) -> i32
  source: src/main.c:10:1
  locals: 0
  blocks:
    entry [0..3]
  instructions:
    0000: ldi      arg=0x00030 (i32, imm=3)    @ 11:3
    0001: ldi      arg=0x00040 (i32, imm=4)    @ 11:7
    0002: add      arg=0x00003 (i32)           @ 11:5
    0003: ret      arg=0x00000                 @ 12:3

Not yet implemented.