docs.rs failed to build tl-lang-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
TL Programming Language
A tensor logic programming language with first-class tensor support, JIT-compiled to LLVM.
Features
- Tensor Operations:
tensor<f32>[128, 128],matmul,topk, etc. via Candle. - Logic Programming: Datalog-style rules with tensor integration.
- Hybrid Execution: Logic terms can access tensor data (
data[i]). - JIT Compilation: High-performance execution using LLVM (Inkwell).
- GPU Support: Metal (macOS) backend supported. CUDA support is planned for the future.
- Optimization: Aggressive JIT optimization and fast logic inference.
Prerequisites (macOS)
Before building, ensure you have the required dependencies installed via Homebrew.
-
Install LLVM 18 and OpenSSL:
-
Configure Environment Variables: Add the following to your shell configuration (e.g.,
~/.zshrc) to help the build system find LLVM 18:Reload your shell (
source ~/.zshrc) before running cargo commands.
Build & Run
# Run a specific example
# Use GPU (Metal on macOS)
Syntax
TL's syntax is very similar to Rust, but without lifetimes.
Basic Syntax
Tensor Operations
if Statement
while Statement
for Statement
Function Definition
Tensor Comprehension
For more details, see Tensor Comprehension
VSCode Extension
A syntax highlighting extension is provided in vscode-tl.
Installation
- Open the
vscode-tldirectory in VSCode. - Press F5 to verify syntax highlighting in a new window.
- Or install manually:
cd vscode-tlnpm install -g vsce(if needed)vsce packagecode --install-extension tensor-logic-0.1.0.vsix
Code Example: N-Queens Problem (Solved via Tensor Optimization)
TensorLogic can solve logical constraints as continuous optimization problems using tensor operations. Below is an example program that solves the N-Queens problem using gradient descent.