AlgTPy is a translator that converts Tunisian High School Algorithmic Language (Algo) into Python code.
It was created as a learning tool to help students quickly test, debug, and run their algorithm exercises without having to manually rewrite them in Python.
In Tunisian high schools, Informatics students are taught using a paper-based algorithmic language (keywords like lire, ecrire, si, tantque, etc.).
This has two major issues:
- Students cannot run their code directly — they only write pseudocode on paper.
- Debugging and testing logic becomes very difficult without execution.
AlgTPy was made to solve this by bridging Algo → Python, so students can:
- Run their exercises on a real computer.
- Test logic, loops, and conditions.
- Learn Python naturally by comparing both languages.
This is an early alpha (0.1a) release.
Currently supported:
- ✅ Variable declaration and assignment
- ✅ Input (
lire) with type detection (entier,réel,booléen,chaine) - ✅ Output (
ecrire) → Pythonprint() - ✅ If / ElseIf / Else statements
- ✅ While loops (
tantque ... faire ... finTantque) - ✅ For loops (
pour ... à ... pas ... finPour) - ✅ Expressions: arithmetic, boolean, comparisons
- ✅ Functions / Procedures
- ✅ Arrays & matrices
- ⏳/✅ File handling (experimental but usable)
- ⏳ Better error messages when translation fails
- ⏳ A small CLI tool for easier usage
python3 main.py -o output.py tests/example.algotests/example.algo→ input file in Algo languageoutput.py→ generated Python file
Algo input:
i <- 0
tantque i < 5 faire
ecrire(i)
i <- i + 1
finTantque
Generated Python:
i = 0
while (i < 5):
print(i)
i = (i + 1)Contributions are welcome! 🎉
If you are a student, teacher, or developer and want to help improve AlgTPy:
- Fork the repository
- Create a new branch (
feature/new-thing) - Commit your changes with clear messages
- Open a Pull Request
Ideas for contribution:
- Adding missing language features (functions, arrays, etc.)
- Improving translation accuracy
- Creating more test files
- Writing documentation / examples