Hello World

A tape program starts with a profile declaration (a file without one is t2) and has 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

Imports such as io come from the standard library that ships with tape; the compiler finds it next to itself, so this works from any directory. Use -I <path> to add your own module directories.

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 (static types: annotated, or inferred from the initializer)
  • 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: