Debug Tools
tape tokens
Dump the raw token stream from the scanner:
tape tokens <file.tape>Output:
1:1 TOK_AT_IDENT "@profile"
1:9 TOK_LPAREN "("
1:10 TOK_IDENT "t1"
1:12 TOK_RPAREN ")"
1:13 TOK_SEMI ";"
2:1 TOK_KW_IMPORT "import"
2:8 TOK_IDENT "io"
2:11 TOK_KW_FROM "from"
2:16 TOK_STRING ""io""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. Uses tape_ast_dump() for structured output showing declarations, expressions, and types.
tape deps
Show resolved import paths:
tape deps <file.tape>Output:
io -> src/tape/stdlib/io.tape
str -> src/tape/stdlib/str.tapeOr if a module can’t be found:
app.tape:3:1: 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 user-defined functions only — it skips:
- Extern stubs (no body /
block_count == 0) - Runtime internals (
__tapert_*prefixed) - Qualified module functions (names containing
.)
Output
fn main (params=0, locals=2, regs=8):
bb0:
%r0 = const_str "Hello, world!"
arg %r0, 0
%r1 = call @io.println, argc=1
%r2 = const_int 0
ret %r2Supports 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: