// docs
Documentation
Learn tape from the ground up — installation, language features, architecture, and API reference.
Getting Started
Download and set up the tape compiler.
Hello WorldYour first tape program — from source to executable.
ExamplesReal tape code examples — from hello world to components and error handling.
ProfilesTape's three strictness profiles: t0 (kernel), t1 (application), t2 (scripting).
Running CodeRun tape programs via the VM interpreter or compile to native executables.
CheatsheetQuick reference for all tape syntax, types, and features.
Language
Line comments, block comments, and nesting behavior.
Primitive TypesInteger, float, boolean, string, void, and color types.
StringsUTF-8 strings, interpolation, escape sequences, and the string/[]u8 boundary.
ConstantsCompile-time constant declarations evaluated before runtime.
Variables & TypesBindings, mutability, and the tape type system.
FunctionsFunction declarations, default parameters, methods, and extern/export.
Control FlowIf/else, while, for loops, match, break, continue, and return.
StructsComposite types with named fields, methods, and swizzle access.
EnumsNamed integer constants with optional description strings.
Error HandlingHow tape handles errors with T or Error — no exceptions, no hidden control flow.
Tagged UnionsDiscriminated unions with pattern matching — safe sum types.
OptionalsNullable values with ?T — safe absence without null pointer bugs.
Pointers & SlicesRaw pointers, const pointers, non-null pointers, slices, and arrays.
Operators & ExpressionsArithmetic, comparison, logical, pipe, cast, and string interpolation.
Defer & ErrdeferScope-exit cleanup — run code when leaving a scope, regardless of how.
Type AliasesCreate named aliases for complex types.
Platform-Specific CodePlatform abstraction via runtime libraries and @link directives.
AttributesUser-defined and built-in attributes for metadata and compiler directives.
refactor() BlocksVirtual module boundaries for safe, compiler-validated code extraction.
ComponentsComponent declaration syntax and keywords.
Components
Tape's first-class component model — props, state, events, dispatch, and views.
Props & StateComponent inputs (props), reactive state (var), and interaction flags (state).
EventsTyped single-handler events — no closures, no listener lists.
Views & SlotsDeclarative view trees, conditional rendering, list rendering, and slots.
Lifecycle & RenderingComponent mount hooks, paint dispatch, and the rendering pipeline.
Component ConstraintsPolymorphic component types via dispatch-based structural constraints.
Memory
Modules
Concurrency
Metaprogramming
@tape blocks replace generics — execute arbitrary code at compile time.
@emit & Code GenerationInject declarations and bindings at compile time using @emit.
Compile-Time Reflection@typeof, @sizeof, @has_field, @has_method — inspect types at compile time.
@embed & Static DataEmbed files and compute constants at compile time.
Refactoring with Virtual ModulesCompiler-validated code extraction using refactor() blocks and tape refactor.
Regions
Sub-languages within .tape files — #code, #view, #style, #test, and more.
#code RegionThe default region — standard tape logic, functions, variables, imports.
#view RegionVisual component declarations — tree syntax, props, slots, and events.
#style RegionCSS-like component styling with variables, transitions, and animations.
#test RegionInline test cases — compiled only during tape test.
#bytecode RegionInline x86-64 assembly for t0 kernel code.
#localization RegionTranslatable strings with compile-time verification.
#resource RegionEmbedded assets — icons, images, fonts, sounds, and binary data.
Architecture
Compiler pipeline from source to binary — scanner, parser, TAC IR, backends.
TAC IRThree-address code intermediate representation — opcodes, registers, and basic blocks.
VM BackendTAC interpreter — direct execution without bytecode encoding.
Native Backendx86-64 and ARM64 code generation — register strategy, instruction encoding, binary emission.
CLI
Compile tape source to a native executable or library.
tape runExecute tape source via the VM interpreter.
tape replInteractive read-eval-print loop for exploring the language.
tape testCompile and run test cases from a file's #test region via the VM.
tape checkType-check source without compiling or running.
Debug Toolstape tokens, tape ast, tape deps, tape disasm — inspect compiler internals.
tape refactorMaterialize refactor() virtual module blocks into actual files.