tape build

Usage

bash
tape build <file.tape> -o <output> [options]

Examples

bash
tape build app.tape -o app.exe                        # Windows executable
tape build app.tape -o app --target linux             # Linux ELF64
tape build app.tape -o app --target uusi              # Uusi ELF64
tape build app.tape -o app --target macos-arm64       # macOS ARM64 Mach-O
tape build lib.tape -o lib.dll --dll                  # Windows DLL (with exports)
tape build lib.tape -o lib.sto --sto --target uusi    # Uusi shared object
tape build lib.tape -o lib.o --sto --target linux     # Linux relocatable object

Options

FlagDescription
-o <path>Output file path (required)
--target <t>Target platform: win64, linux, macos, macos-arm64, uusi (default: host)
--dllEmit as shared library (DLL on Windows, object on macOS/Linux)
--stoEmit as shared/relocatable object (STO on Uusi, .o on Linux/macOS)
--skip-link-checkSkip @link library/symbol verification
-I <path>Add module search path (for imports)
--humanHuman-readable errors with color, source context, and carets (default: LLM-friendly terse format)
--max-errors <N>Stop after N errors (default: unlimited)

Build process

  1. Split source into regions (#code, #view, etc.)
  2. Parse #code region (with rt0 preamble if no imports)
  3. Parse #view region, merge components into module
  4. Resolve imports (if any) → parse dependencies recursively
  5. Execute @tape blocks (compile-time metaprogramming)
  6. Type check
  7. Lower to TAC IR
  8. Verify @link references (unless --skip-link-check)
  9. Native codegen (x86-64 or ARM64 depending on target)
  10. Emit binary (PE64, ELF64, or Mach-O)

Runtime preamble

For simple programs without imports, the compiler prepends a minimal runtime preamble that declares platform-specific extern functions (e.g. WriteFile/ExitProcess on Windows, __syscall1..__syscall6 on Uusi). If the source has import statements, the preamble is skipped — the runtime library provides these through tapert100.

Cross-compilation

The compiler can target any supported platform from any host:

bash
# On Windows, build for Uusi:
tape build kernel.tape -o kernel --target uusi

# On Windows, build for Linux:
tape build server.tape -o server --target linux

# On any host, build for macOS ARM64:
tape build app.tape -o app --target macos-arm64

Output by target and flags

TargetDefault--dll--sto
win64PE64 executablePE64 DLL (export table)
linuxELF64 executable (dynamic linking)Relocatable .oRelocatable .o
macosMach-O executableMach-O objectMach-O object
macos-arm64Mach-O executable (ARM64)Mach-O objectMach-O object
uusiELF64 executable (static, syscalls)STO (vtable exports)

Last modified: