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 arg2

How it works

  1. Split source into regions
  2. Parse #code and #view regions (with rt0 preamble if no imports)
  3. If imports present: re-parse without preamble, resolve modules
  4. Execute @tape blocks (compile-time metaprogramming)
  5. Type check
  6. Lower to TAC IR
  7. 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

FlagDescription
--Separator between tape options and program arguments
-I <path>Add module search path
--target <t>Target platform (affects rt0 preamble selection)
--humanHuman-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));
    }
}

The VM searches for @link libraries in this order:

  1. The source file’s directory
  2. System default paths (PATH on Windows, LD_LIBRARY_PATH on Linux)

Exit codes

The VM returns whatever main() returns:

tape
fn main() -> i64 {
    return 0;
}
Exit codeMeaning
0+Value returned by main()
-1No main function found, or VM error (division by zero, stack overflow)
Plannedtape 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: