Hello World

Every tape program starts with a profile declaration and a main function.

tape
@profile(t1);
import io from "io";

pub fn main() -> i32 {
    io.println("Hello, world!");
    return 0;
}

Running it

There are two ways to execute tape code:

bash
tape run hello.tape       # interpret via VM
tape build hello.tape -o hello   # compile to native executable

The tape run command compiles to bytecode-encoded TAC and interprets it. The tape build command compiles to a native x86-64 executable — same source, both paths.

What’s happening here

  • @profile(t1) — declares this is a typed application (full type annotations required)
  • import io from "io" — imports the standard I/O module
  • pub fn main() -> i32 — the entry point, returns an exit code
  • io.println(...) — prints a string followed by a newline

Next steps

  • Profiles — what t0, t1, and t2 mean and when to use each one

Last modified: