Debug Tools
tape tokens
Dump the raw token stream from the scanner:
tape tokens <file.tape>Output:
1:1 AT "@"
1:2 IDENT "profile"
1:9 LPAREN "("
1:10 IDENT "t1"
1:12 RPAREN ")"
1:13 SEMICOLON ";"
2:1 KW_IMPORT "import"
2:8 IDENT "io"
2:11 KW_FROM "from"
2:16 STRING_LIT ""io""
2:20 SEMICOLON ";"Each line: line:col token_type "lexeme". Scans the entire file without region splitting.
tape ast
Dump the parsed abstract syntax tree:
tape ast <file.tape>Parses the #code and #view regions and prints the resulting AST as tape source (tape_ast_dump()): every declaration, expression and type as the parser understood it.
tape deps
Show resolved import paths:
tape deps <file.tape>Output:
io -> stdlib/io.tape
str -> stdlib/str.tapeModules are searched as for tape build: -I paths, ./stdlib, then stdlib/ next to the tape binary. If a module can’t be found:
app.tape:3:8: error: unresolved module 'missing'Prints (no imports) if the file has no import statements. Exit code 1 if any imports are unresolved.
tape disasm
Compile a source file through the full pipeline (comptime → typecheck → lower) and dump the resulting TAC IR:
tape disasm <file.tape> [--all] [--filter <name>]Options
| Flag | Description |
|---|---|
--all | Show all functions including stdlib/runtime |
--filter <name> | Only show functions whose name contains <name> |
Default behavior
Without flags, tape disasm shows the file’s own functions — those of the root module, including what the compiler generates for its components (view builders, prop setters, dispatch stubs). It skips:
- Every imported module, the standard library included (
--allshows them) - Extern stubs (no body /
block_count == 0) - Runtime internals (
__tapert_*prefixed)
Output
fn main (params=0, locals=0, regs=9):
bb0:
%r0 = alloca 24
%r1 = const_str "Hello, world!"
store_field %r0, %r1, off=0
%r2 = const_int 13
store_field %r0, %r2, off=8
%r3 = const_int 0
store_field %r0, %r3, off=16
%r4 = load_field %r0, 0, off=0
%r5 = load_field %r0, 8, off=8
%r6 = alloca 16
store_field %r6, %r4, off=0
store_field %r6, %r5, off=8
arg %r6, 0
%r7 = call @println, argc=1
%r8 = const_int 0
ret %r8Supports multi-module files (with imports) — resolves dependencies and compiles the full module graph before dumping.
Combining tools
tape tokens file.tape | less # page through tokens
tape ast file.tape > ast_dump.txt # save AST for review
tape disasm file.tape --filter main # disasm only "main"
tape disasm file.tape --all # see everything including stdlib
tape deps file.tape # check import resolutionLast modified: