Skip to content
@glimlang

GlimLang

A tiny, expressive programming language.
GlimLang Gecko Mascot

GLIM | LANG

A tiny, expressive programming language written in pure Python.

PyPI License Python

PyPI Downloads Version


🦎 What is GlimLang?

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.


⚑ Install

pip install glimlang==1.2.2

Verify installation:

gl version
# GlimLang v1.2.2

Run your first script:

gl run hello.glim
# Hello, GlimLang world! βœ“

✨ Features

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

πŸš€ Quick Examples

Hello World

print "Hello, GlimLang world!"

Variables & Types

let name = "Glim"
let version = 1.2
let active = true
print f"Welcome to {name} v{version}"

Pattern Matching

let day = "Sat"

match day {
  "Sat" | "Sun" => print "Weekend!"
  "Mon"         => print "Back to work."
  _             => print "Midweek grind."
}

Classes & OOP

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.

Functions & Closures

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 / Catch

try {
  let result = 10 / 0
} catch(e) {
  print f"Error caught: {e}"
}

πŸ—οΈ Compiler Pipeline

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.


πŸ“– CLI Reference

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

πŸ“¦ Requirements

  • Python 3.8 or higher
  • No external dependencies

πŸ“„ License

GlimLang is dual-licensed under the Apache License 2.0.

You may use this project under the terms of either license at your option.


🀝 Contributing (soon Avaliable Repo)

Contributions, issues, and feature requests are welcome!

  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

🌐 Links

🌐 glimlang.org Β Β·Β  πŸ“– Docs Β Β·Β  πŸ’¬ Discord Β Β·Β  πŸ“¦ PyPI Β Β·Β  ⭐ Star on GitHub


Made with 🦎 by the GlimLang Community

Popular repositories Loading

  1. .github .github Public

Repositories

Showing 1 of 1 repositories

Top languages

Loading…

Most used topics

Loading…