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 -I stdlib            # interpret via VM
tape build hello.tape -I stdlib -o hello # compile to native executable

-I stdlib tells the compiler where to find the standard library that ships in the release archive. Every program with an import needs it.

The tape run command interprets the TAC IR directly. The tape build command compiles that same IR to a native 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: