tlang is a lightweight tool that lets you run algorithms directly—without writing full implementation code.
Instead of coding the algorithm manually, you simply write the logic in a .algo file, and tlang converts it into executable code.
[!NOTE]Version: v1 (Weekend project)
Install tlang directly from GitHub using pip:
Bash
pip install git+https://github.com/tdizhere/tlang.git
-
Write your algorithm in a .algo file (currently supports arrays only).
-
Run it using the command line:
Bash
tlang .filenamealgo
Create a file named example.algo and write your algorithm steps. Then, execute it:
Bash
tlang example.algo
tlang acts as a translator between human-readable algorithm logic and real code.
-
Parsing: It reads the steps written in your .algo file.
-
Translation: It parses the logic and converts the steps into executable Python code.
-
Execution: It runs the generated code instantly, allowing you to test logic without manual implementation.
| Feature | Supported | Notes |
|---|---|---|
| Algorithm Header | ✅ | ALGORITHM <Name> required |
| Input Declaration | ✅ | INPUT a, b, ... |
| SET Statement | ✅ | SET x = expr |
| RETURN Statement | ✅ | Exactly one RETURN required |
| IF Statement | ✅ | IF cond THEN ... END IF |
| FOR EACH Loop | ✅ | FOR EACH x IN arr ... END FOR |
| Nested Blocks | ✅ | Nested IF/LOOP supported |
| Arithmetic Operators | ✅ | + - * / % |
| Comparison Operators | ✅ | == != > < >= <= |
| Execution Trace Output | ✅ | Shows step-by-step trace |
| Function Calls | ❌ | Blocked for security |
| Attribute Access | ❌ | Blocked for security |
| Boolean Operators | ❌ | and, or, not blocked |
| Chained Comparisons | ❌ | 1 < x < 5 blocked |
| Lists / Dicts / Sets in expr | ❌ | Not allowed in expressions |
| User-defined Functions | ❌ | Not supported yet |
-
Version 1: This is an initial release.
-
Support: Currently supports array-based algorithms only.
-
Project Scope: Designed as a simple weekend project aimed at simplifying algorithm execution and prototyping.