A Rust implementation of the Teal programming language compiler.
Tear compiles Teal (a typed dialect of Lua) source files into Lua, with full type checking and support for multiple Lua target versions.
Compatibility
Tested against the upstream teal-lang/tl spec suite at commit ed9ff68.
Benchmarks
| Case | Speedup |
|---|---|
| small.tl | ~27x faster |
| medium.tl | ~23x faster |
| large.tl | ~20x faster |
Installation
Homebrew
brew install tear-project/tap/tear
From source
cargo install --git https://github.com/tear-project/tear.git
Usage
# Type-check a file tear check samples/hello.tl # Generate Lua from Teal tear gen samples/hello.tl # Run a Teal file directly tear run samples/hello.tl # Report inferred types as JSON tear types samples/hello.tl # List available warning categories tear warnings
Project Structure
Tear is organized as a Cargo workspace with 7 sub-crates:
tear/
├── tear-core # Shared types: AST, tokens, type system, errors
├── tear-lexer # Tokenizer
├── tear-parser # Recursive descent parser
├── tear-env # Type environment and standard library
├── tear-check # Type checker
├── tear-gen # Lua code generator
└── tear-config # tlconfig.lua parser
License
MIT
