Website

TAPL is designed to simplify the process of creating and extending programming languages with strong typing capabilities.

At its core, TAPL provides a strongly typed Python-like language that can be extended with custom parsers and type-checker rules.

[!IMPORTANT]
- TAPL is an experimental project with no working compiler or toolchain yet.
- There is no stable release yet, and it improves with every commit. Please report any issues via the Tapl Issue Tracker.
- It is not an officially supported Google product.

TAPL is inspired by lambda calculus and the principle that the same computational techniques apply to both type and term layers. The project is devoted to and named after Benjamin C. Pierce's book "Types and Programming Languages".

How TAPL works

As a compiler frontend, TAPL's primary role is to parse source code and generate an Intermediate Representation (IR) for a backend. Currently, TAPL uses Python's Abstract Syntax Tree (AST) as its backend IR.

The compilation process is unique: for each source file, TAPL generates two Python files:

To ensure type safety, the type-checker file must be run first. If it executes successfully, the untyped code is guaranteed to be type-safe.

For more details on TAPL's design and architecture:
- Compilation process diagrams
- TAPL calculus documentation

Getting started

Here is a simple "Hello World!" program in TAPL:

language pythonlike

print('Hello World!')

To run this code:

  1. Clone the repository:
git clone https://github.com/tapl-org/tapl.git
  1. Navigate to the Python package directory:
cd tapl/python/tapl-lang
  1. Run the TAPL CLI using Hatch:
hatch run python ./src/tapl_lang/cli/tapl.py  ./src/examples/hello_world.tapl

This run the code. Behind the scene, This will generate two files:

For more example, see easy.tapl

Creating and Extending Languages (tutorial)

Goal: add a Pipe operator |> to a Python-like TAPL language.

  1. Implement the extension
  1. Example TAPL program using new pipeweaver language:
language pipeweaver

-2.5 |> abs |> round |> print
  1. Compile and type-check
hatch run python ./src/tapl_lang/cli/tapl.py ./src/examples/pipe.tapl

This generates two files:
- pipe1.py — type-checker
- pipe.py — untyped/executable code

Notes
- See the repository file pipeweaver_language.py for the implementation details and how the parser/transformer registers the operator and type rules.
- Inspect the generated pipe1.py to understand how TAPL emits type-checking code and pipe.py for the runtime translation.

Implementing Dependent Types

Coming soon: a codelab demonstrating how to implement concat — a function that concatenates two fixed-length arrays and returns an array whose type reflects the sum of their lengths.

Community

join the conversation on our main community platforms:
- Official Discord Server.
- Github Discussions

Future Project Goals


Tags: langdev  

Last modified 22 March 2026