This project is AI spec-coding driven — built entirely by AI from a specification document using Claude Code.
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.
| File | tear | tl | Speedup |
|---|---|---|---|
| small.tl (12 lines) | 1.5 ms | 30.1 ms | ~20x faster |
| medium.tl (141 lines) | 1.4 ms | 37.1 ms | ~26x faster |
| large.tl (340 lines) | 1.8 ms | 45.9 ms | ~25x faster |
Tear is roughly 20-26x faster than the reference Teal compiler for code generation.
Tear passed 573 integration test cases.
brew install rustq/tap/tear# Type-check all samples
tear check samples/hello.tl
# Generate Lua from a sample
tear gen samples/hello.tl
# Run a sample directly
tear run samples/hello.tlTear 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
MIT
