GlyphLang™ is an AI-first backend programming language designed to reduce boilerplate, lower LLM token costs, and ship production APIs faster.
Modern backend development is increasingly written with AI—but existing languages and frameworks were never designed for AI generation. The result is bloated code, fragile outputs, high token costs, and endless glue logic.
GlyphLang is built from the ground up to be: - Easy for AI to generate - Strict enough for production - Opinionated enough to stay simple
It compiles to a single static binary, includes a built-in HTTP server and database access, and minimizes files, syntax and configuration so both humans and AI can move faster.
Why GlyphLang?
Same API, fewer tokens, fewer files:
FastAPI: - ~300 lines - 6–8 files - External server, routing, validation, glue code
GlyphLang: - ~60–80 lines - 1 file - Built-in server, routing, validation
Less code isn't just productivity. It directly reduces: - LLM token usage - Generation errors - Maintenance surface area
Glyph: @ GET /users/:id -> User (21 tokens)
Python: @app.route('/users/<id>')... (35 tokens)
Java: @GetMapping("/users/{id}")... (28 tokens)
What you get
Who is this for?
T?), union (A | B), genericsAll, Race, Any combinators.glyph sourceprovider Name { method(...) -> Type }GlyphLang uses a small set of symbols for consistent, scannable syntax:
| Symbol | Name | Usage | Example |
|---|---|---|---|
@ |
Route | HTTP endpoint definition | @ GET /users |
: |
Type | Type definition | : User { id: int } |
$ |
Variable | Variable declaration | $ name = "Alice" |
! |
Function | Function/CLI command definition | ! greet(name: str) |
> |
Return | Return statement | > {message: "ok"} |
+ |
Middleware | Apply middleware | + auth(jwt) |
% |
Inject | Dependency injection | % db: Database |
? |
Optional | Optional type modifier | email: str? |
* |
Cron | Scheduled task definition | * "0 * * * *" cleanup |
~ |
Event | Event handler definition | ~ user.created |
& |
Queue | Queue worker definition | & emails processEmail |
# |
Comment | Single-line comment | # This is a comment |
-> |
Arrow | Return type annotation | -> User |
\| |
Union | Union type separator | str \| int |
Type Modifiers:
- T! - Required (non-null)
- T? - Optional (nullable)
- [T] - Array of T
Windows Installer (Recommended):
Download and run the installer: glyph-windows-setup.exe
Note: Code signing via SignPath is pending approval. You may see a Windows SmartScreen warning when running the installer - click "More info" then "Run anyway" to proceed.
Download binary:
# Linux
curl -L https://github.com/GlyphLang/GlyphLang/releases/latest/download/glyph-linux-amd64.zip -o glyph.zip
unzip glyph.zip && chmod +x glyph-linux-amd64 && sudo mv glyph-linux-amd64 /usr/local/bin/glyph
# macOS (Intel)
curl -L https://github.com/GlyphLang/GlyphLang/releases/latest/download/glyph-darwin-amd64.zip -o glyph.zip
unzip glyph.zip && chmod +x glyph-darwin-amd64 && sudo mv glyph-darwin-amd64 /usr/local/bin/glyph
# macOS (Apple Silicon)
curl -L https://github.com/GlyphLang/GlyphLang/releases/latest/download/glyph-darwin-arm64.zip -o glyph.zip
unzip glyph.zip && chmod +x glyph-darwin-arm64 && sudo mv glyph-darwin-arm64 /usr/local/bin/glyph
Windows (PowerShell):
Invoke-WebRequest -Uri "https://github.com/GlyphLang/GlyphLang/releases/latest/download/glyph-windows-amd64.zip" -OutFile glyph.zip
Expand-Archive glyph.zip -DestinationPath . ; Move-Item glyph-windows-amd64.exe glyph.exe
Or build from source:
git clone https://github.com/GlyphLang/GlyphLang.git
cd GlyphLang && go build -o glyph ./cmd/glyph
The official GlyphLang extension is available on the Visual Studio Code Marketplace:
Features: - Syntax Highlighting - Full semantic highlighting for all GlyphLang symbols and constructs - LSP Integration - Real-time error checking, code completion, and hover documentation - Go to Definition - Navigate to type definitions, functions, and imports - Find References - Locate all usages of symbols across your project - Rename Symbol - Safely rename variables, functions, and types - Diagnostics - Inline error and warning messages as you type
To install, search for "GlyphLang" in the VS Code Extensions panel or run:
ext install GlyphLang.GlyphLang
Create hello.glyph:
@ GET /hello {
> {message: "Hello, World!"}
}
@ GET /greet/:name {
> {message: "Hello, " + name + "!"}
}
Run it:
glyph run hello.glyph
Visit http://localhost:3000/hello
: User {
id: int!
name: str!
email: str?
roles: [str]!
}
: ApiResponse<T> {
data: T?
error: str?
success: bool!
}
@ GET /api/users/:id -> User | Error {
+ auth(jwt)
+ ratelimit(100/min)
% db: Database
$ user = db.query("SELECT * FROM users WHERE id = ?", id)
if user == null {
> {error: "User not found", code: 404}
}
> user
}
@ GET /status/:code {
$ result = match code {
200 => "OK"
201 => "Created"
400 => "Bad Request"
404 => "Not Found"
n when n >= 500 => "Server Error"
_ => "Unknown"
}
> {status: code, message: result}
}
# Basic async block - executes in background, returns Future
@ GET /compute {
$ future = async {
$ x = 10
$ y = 20
> x + y
}
$ result = await future
> {value: result}
}
# Parallel execution - all requests run concurrently
@ GET /dashboard {
$ userFuture = async { > db.getUser(userId) }
$ ordersFuture = async { > db.getOrders(userId) }
$ statsFuture = async { > db.getStats(userId) }
# Await blocks until Future resolves
$ user = await userFuture
$ orders = await ordersFuture
$ stats = await statsFuture
> {user: user, orders: orders, stats: stats}
}
! identity<T>(x: T): T {
> x
}
! first<T>(a: T, b: T): T {
> a
}
! map<T, U>(arr: [T], fn: (T) -> U): [U] {
$ result = []
for item in arr {
$ mapped = fn(item)
result = append(result, mapped)
}
> result
}
# utils.glyph
! formatName(first: str, last: str): str {
> first + " " + last
}
# main.glyph
import "./utils"
@ GET /user/:id {
$ name = utils.formatName(user.first, user.last)
> {displayName: name}
}
# Define reusable patterns with macros
macro! validate_required(field) {
if field == null {
> {error: "field is required", status: 400}
}
}
macro! json_response(data, status) {
> {data: data, status: status, timestamp: now()}
}
# CRUD pattern - what macro expansion produces:
@ GET /users {
> db.query("SELECT * FROM users")
}
@ GET /users/:id {
> db.query("SELECT * FROM users WHERE id = ?", id)
}
@ POST /users {
> db.insert("users", input)
}
@ DELETE /users/:id {
> db.query("DELETE FROM users WHERE id = ?", id)
}
# Daily cleanup at midnight
* "0 0 * * *" daily_cleanup {
% db: Database
> {task: "cleanup", timestamp: now()}
}
# Every 5 minutes health check
* "*/5 * * * *" health_check {
> {status: "healthy", checked_at: now()}
}
# Weekly report on Sundays at 9am with retries
* "0 9 * * 0" weekly_report {
+ retries(3)
% db: Database
> {week: "current", generated_at: now()}
}
# Handle user creation event
~ "user.created" {
$ user_id = event.id
$ email = event.email
> {handled: true, user_id: user_id}
}
# Async event handler
~ "order.completed" async {
$ order_id = event.order_id
$ total = event.total
> {processed: true, order_id: order_id}
}
# Email sending worker with concurrency and retries
& "email.send" {
+ concurrency(5)
+ retries(3)
+ timeout(30)
$ to = message.to
$ subject = message.subject
> {sent: true, to: to}
}
# Image processing worker
& "image.process" {
+ concurrency(3)
+ timeout(120)
$ image_id = message.image_id
> {processed: true, image_id: image_id}
}
# Basic WebSocket chat
@ ws /chat {
on connect {
ws.join("lobby")
ws.broadcast("User joined the chat")
}
on message {
ws.broadcast(input)
}
on disconnect {
ws.broadcast("User left the chat")
ws.leave("lobby")
}
}
# WebSocket with room parameter
@ ws /chat/:room {
on connect {
ws.join(room)
ws.broadcast_to_room(room, "User joined")
}
on message {
ws.broadcast_to_room(room, input)
}
on disconnect {
ws.broadcast_to_room(room, "User left")
ws.leave(room)
}
}
# Simple command with required argument
! hello name: str! {
$ greeting = "Hello, " + name + "!"
> {message: greeting}
}
# Command with multiple arguments
! add a: int! b: int! {
$ result = a + b
> {sum: result}
}
# Command with optional flag
! greet name: str! --formal: bool = false {
if formal {
> {greeting: "Good day, " + name}
} else {
> {greeting: "Hey " + name + "!"}
}
}
# Command with description
! version "Show version information" {
> {name: "MyApp", version: "1.0.0"}
}
Run commands with:
glyph exec app.glyph hello --name Alice
glyph exec app.glyph add --a 5 --b 3
glyph exec app.glyph greet --name Bob --formal
glyph commands app.glyph # List all commands
These commands are designed for AI coding assistants and agents:
# Generate context for AI agents (fits in context windows)
glyph context # Full project context as JSON
glyph context --format compact # Minimal text (fewer tokens)
glyph context --changed # Only changes since last run
glyph context --for route # Focus on routes only
glyph context --for type # Focus on type definitions
# Validate with structured output for AI to parse and fix
glyph validate main.glyph --ai # JSON errors with fix hints
glyph validate src/ --ai # Validate entire directory
Example AI workflow:
# 1. Agent gets project context
glyph context --format compact > context.txt
# 2. Agent makes changes, then validates
glyph validate src/ --ai | agent-fix-errors
# 3. Agent checks what changed
glyph context --changed
```bash glyph run # Run a Glyph file glyph dev
$ claude mcp add GlyphLang \
-- python -m otcore.mcp_server <graph>