Tea LogoTea
Getting Started
  • Introduction
  • Installation
  • Quick Start
  • Project Structure
Language Guide
  • Syntax Basics
  • Type System
  • Functions
  • Classes & Objects
  • Generics
  • Pattern Matching
  • Error Handling
Advanced Topics
  • Modules & Imports
  • Concurrency
  • Memory Management
  • Metaprogramming
Standard Library
  • Overview
  • Collections
  • File System
  • JSON & YAML
  • Process Management
Contributing
  • Contributing Guide
  • Code Style
  • Testing
ExamplesReferencePlaygroundGitHub

Getting Started with Tea

This guide will help you install Tea, write your first program, and understand the basics of the language. You'll be up and running in less than 10 minutes.

Prerequisites

Before installing Tea, make sure you have:

  • Git - Version control system (download here)
  • C++ Compiler - GCC 9+ or Clang 10+ for building from source
  • LLVM 14+ - Required for native compilation
  • Make - Build automation tool

Installation

1

Clone the Repository

First, clone the Tea repository from GitHub to your local machine:

git clone https://github.com/special-tea/tea.git
cd tea
2

Build and Install

Run the setup script to build Tea and install it to your system:

make setup
make install

This will compile the Tea compiler and install it to /usr/local/bin by default. You may need to use sudo for installation.

3

Verify Installation

Check that Tea is installed correctly:

tea --version

You should see output like:

Tea version 0.1.0

Your First Tea Program

Let's write a simple "Hello, World!" program to get started.

Create hello.tea

Create a new file called hello.tea with the following content:

# hello.tea
print("Hello, Tea!")

Run your program

Execute your program using Tea:

tea run hello.tea

Output:

Hello, Tea!

Compile to native binary

Compile your program to a native binary for optimal performance:

tea compile hello.tea -o hello
./hello

The compiled binary runs directly on your system with no runtime dependencies.

A More Complex Example

Let's explore Tea's features with a program that demonstrates functions, types, and control flow.

# greet.tea

# Define a function with type annotations
def greet(name: String, age: Int) -> String
  if age < 18
    "Hello, young ${name}!"
  else
    "Hello, ${name}!"
  end
end

# Create an array of names
var people = [
  {"name": "Alice", "age": 25},
  {"name": "Bob", "age": 16},
  {"name": "Charlie", "age": 30}
]

# Iterate and greet each person
for person of people
  var message = greet(person["name"], person["age"])
  print(message)
end

Output:

Hello, Alice!
Hello, young Bob!
Hello, Charlie!

Key Concepts Demonstrated

  • Function Definitions: Use def with type annotations for parameters and return types
  • String Interpolation: Embed variables in strings using ${variable}
  • Control Flow: Use if/else for conditional logic
  • Loops: Iterate over collections with for...of
  • Type Inference: Variables like message have their types inferred automatically

Next Steps

Now that you've written your first Tea programs, here's what to explore next:

Learn the Syntax

Deep dive into Tea's syntax and language features

Understand Types

Master Tea's static type system and inference

Browse Examples

See real-world Tea programs and patterns

Explore the Standard Library

Discover built-in functions and modules

Need Help?

If you run into any issues or have questions, here are some resources:

Report an IssueJoin DiscordRead the Docs

© 2025 Tea Language. Open source under MIT License.

ContributeGitHubCommunity