GlimLang is a clean, friendly, and highly readable scripting language designed for clear syntax, rich built-ins, and fast prototyping. It features a complete hand-written pipeline β Lexical Scanner β Pratt Parser β Abstract Syntax Tree β Tree-Walking Interpreter β entirely in pure Python with zero external dependencies.
Designed for Developers: GlimLang strips away the complex, low-level optimization layers of standard production runtimes. It provides a fully transparent, highly readable codebase where you can observe exactly how scoping, classes, closures, and pattern matching run under the hood.
pip install glimlang==1.2.2Verify installation:
gl version
# GlimLang v1.2.2Run your first script:
gl run hello.glim
# Hello, GlimLang world! β| Feature | Description |
|---|---|
| π Pattern Matching | Robust match with pipes |, wildcards _, and multi-arm blocks |
| ποΈ OOP Classes | Blueprint templates, custom constructors, self-referencing properties |
| βοΈ Zero Dependencies | Pure Python 3.8+ β no external libraries required |
| β‘ 40+ Built-ins | Rich standard library out of the box |
| π Pratt Parser | Hand-written operator-precedence AST builder |
| π§ Lexical Closures | First-class functions with dynamic environment scope maps |
| π§ͺ Try/Catch Diagnostics | Deep exception frames with positional line and column error mapping |
| π REPL | Interactive Read-Eval-Print Loop terminal session via gl repl |
print "Hello, GlimLang world!"
let name = "Glim"
let version = 1.2
let active = true
print f"Welcome to {name} v{version}"
let day = "Sat"
match day {
"Sat" | "Sun" => print "Weekend!"
"Mon" => print "Back to work."
_ => print "Midweek grind."
}
class Greeter {
def init(name) {
self.name = name
}
def greet(user) {
print f"Hello, {user}! I am {self.name}."
}
}
let bot = Greeter("GlimBot")
bot.greet("Developer")
# Output: Hello, Developer! I am GlimBot.
def make_counter() {
let count = 0
fn increment() {
count = count + 1
return count
}
return increment
}
let counter = make_counter()
print counter() # 1
print counter() # 2
print counter() # 3
try {
let result = 10 / 0
} catch(e) {
print f"Error caught: {e}"
}
Source Code
β
Lexical Scanner β Tokenizes source character-by-character
β
Pratt Parser β Builds AST using operator-precedence grammar
β
Abstract Syntax Tree (AST)
β
Tree-Walking Interpreter β Executes AST nodes recursively
β
Output
Every stage is hand-written in readable Python β no generated parsers, no external lexer tools.
| Command | Description |
|---|---|
gl run <file> |
Execute a .glim script file |
gl repl |
Launch interactive REPL session |
gl version |
Print installed GlimLang version |
gl help |
Show all available CLI commands |
- Python 3.8 or higher
- No external dependencies
GlimLang is dual-licensed under the Apache License 2.0.
You may use this project under the terms of either license at your option.
Contributions, issues, and feature requests are welcome!
- Fork the repository
- Create your feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
π glimlang.org Β Β·Β π Docs Β Β·Β π¬ Discord Β Β·Β π¦ PyPI Β Β·Β β Star on GitHub
Made with π¦ by the GlimLang Community
