tape run
Usage
bash
tape run <file.tape> [-- args...]Examples
bash
tape run hello.tape
tape run server.tape -- --port 8080
tape run app.tape -I libs/ -- arg1 arg2How it works
- Split source into regions
- Parse
#codeand#viewregions (with rt0 preamble if no imports) - If imports present: re-parse without preamble, resolve modules
- Execute
@tapeblocks (compile-time metaprogramming) - Type check
- Lower to TAC IR
- Interpret TAC directly via the VM (no bytecode encoding)
The VM finds main() and executes it. Extern functions are resolved at runtime through FFI (LoadLibrary/dlopen).
Options
| Flag | Description |
|---|---|
-- | Separator between tape options and program arguments |
-I <path> | Add module search path |
--target <t> | Target platform (affects rt0 preamble selection) |
--human | Human-readable error output |
--max-errors <N> | Stop after N errors |
Program arguments
Everything after -- is passed to the running program. Access via os.args():
tape
import os from "os";
fn main() {
let count = os.args_count();
for (var i: i64 = 0; i < count; i = i + 1) {
io.println(os.arg_get(i));
}
}FFI library search
The VM searches for @link libraries in this order:
- The source file’s directory
- System default paths (
PATHon Windows,LD_LIBRARY_PATHon Linux)
Exit codes
The VM returns whatever main() returns:
tape
fn main() -> i64 {
return 0;
}| Exit code | Meaning |
|---|---|
| 0+ | Value returned by main() |
| -1 | No main function found, or VM error (division by zero, stack overflow) |
Planned —
tape run will accept pre-compiled .tb bytecode bundles, allowing distribution and execution without source or re-compilation. This requires the bytecode encoding format (see ).Last modified: