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
- AI-optimized syntax that minimizes boilerplate and token usage
- Built-in HTTP server, async, database access, and WebSockets
- Single static binary deployment
- First-class CLI, LSP, and VS Code support
- Designed for real production backends—not demos
Who is this for?
- GlyphLang is a great fit if you:
- Build AI-powered APIs or internal tools
- Use LLMs heavily for backend code generation
- Want fewer files, fewer abstractions, and lower AI costs
- Prefer opinionated tooling over endless configuration
- Minimal Ceremony - Skip the boilerplate—routes and types are the program
- Context Command - Generate project summaries optimized for LLM context windows
- Structured Validation - JSON error output for AI agents to parse and fix
- Consistent Patterns - Every route and type definition follows the same structure
- Type System - int, string, bool, float, arrays, objects, optional (
T?), union (A | B), generics - Pattern Matching - match expressions with guards and destructuring
- Async/Await - futures with
All,Race,Anycombinators - Modules - file imports, aliases, selective imports
- Generics - type parameters, inference, constraints
- Macros - compile-time code generation
- Bytecode Compiler - 3 optimization levels
- JIT Compilation - type specialization, hot path detection
- Hot Reload - instant updates during development
- Debug Mode - breakpoints, variable inspection, REPL
- HTTP Server - routes, middleware, WebSocket support
- Database - PostgreSQL with pooling, transactions, migrations
- Security - JWT auth, rate limiting, CORS, SQL injection prevention
- Observability - logging, Prometheus metrics, OpenTelemetry tracing
- Polyglot Output - Generate Python/FastAPI or TypeScript/Express servers from the same
.glyphsource - Custom Providers - Define provider contracts with
provider Name { method(...) -> Type } - Semantic IR - Language-neutral intermediate representation powers multi-target output
- LSP Server - full IDE support with completions, diagnostics, rename
- VS Code Extension - syntax highlighting, LSP support, error checking
- CLI - compile, run, REPL, decompile, AI context commands
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/glyphWindows (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.exeOr build from source:
git clone https://github.com/GlyphLang/GlyphLang.git
cd GlyphLang && go build -o glyph ./cmd/glyphThe 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.glyphVisit 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 commandsThese 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 directoryExample 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 --changedglyph run <file> # Run a Glyph file
glyph dev <file> # Development server with hot reload
glyph compile <file> # Compile to bytecode
glyph decompile <file> # Decompile bytecode
glyph codegen <file> # Generate server code (default: Python/FastAPI)
glyph codegen <file> --lang typescript -o ./out # TypeScript/Express
glyph lsp # Start LSP server
glyph init # Initialize new project
glyph commands <file> # List CLI commands in a file
glyph exec <file> <cmd> # Execute a CLI command
glyph version # Show versionToken counts measured with tiktoken on equivalent code samples.
| Sample | Glyph | FastAPI | Flask | Java |
|---|---|---|---|---|
| Hello World API | 16 | 20 | 37 | 45 |
| User GET with Param | 24 | 28 | 35 | 28 |
| Protected Route | 22 | 29 | 27 | 32 |
| POST with Validation | 58 | 78 | 95 | 95 |
| Type Definition | 29 | 38 | 49 | 159 |
| CRUD API | 122 | 150 | 148 | 186 |
| WebSocket Handler | 78 | 108 | 144 | 246 |
| Total | 349 | 451 | 535 | 791 |
| vs Glyph | — | 23% more | 36% more | 57% more |
| Comparison | Savings |
|---|---|
| vs FastAPI (Python) | 23% fewer tokens |
| vs Flask (Python) | 36% fewer tokens |
| vs Java (Spring) | 57% fewer tokens |
FastAPI is the fairest Python comparison as it's the most concise mainstream framework.
The savings come from structural elimination, not symbol replacement (> vs return saves ~1 token):
FastAPI Hello World (20 tokens):
@app.get("/hello") # decorator overhead
def hello(): # function definition
return {"message": "Hello"} # return statement
Flask Hello World (37 tokens):
from flask import Flask, jsonify # 6 tokens (eliminated in Glyph)
app = Flask(__name__) # 6 tokens (eliminated)
@app.route('/hello', methods=['GET'])# verbose decorator
def hello(): # function definition
return jsonify({...}) # wrapper function
Glyph Hello World (16 tokens):
@ GET /hello {
> {message: "Hello, World!"}
}
Even against FastAPI (the most concise Python framework), Glyph saves 23% by eliminating the function definition ceremony.
Run python benchmarks/bench_ai_efficiency.py to reproduce. Verify with tiktoken.
| Metric | Value |
|---|---|
| Compilation | ~867 ns |
| Execution | 2.95-37.6 ns/op |
| Test Coverage | 78% (24 packages) |
| Examples | 100% compatibility |
GlyphLang/
├── cmd/glyph/ # CLI application
├── pkg/
│ ├── parser/ # Lexer and parser
│ ├── interpreter/ # AST interpreter
│ ├── compiler/ # Bytecode compiler
│ ├── vm/ # Virtual machine
│ ├── jit/ # JIT compiler
│ ├── server/ # HTTP server
│ ├── database/ # Database integration
│ ├── security/ # Auth, rate limiting
│ ├── lsp/ # Language server
│ └── ... # Other packages
├── examples/ # Example projects
├── docs/ # Documentation
└── tests/ # Integration tests
We welcome questions, feedback, and contributions from the community.
Get Help and Connect:
- GitHub Discussions - Ask questions, share ideas, and discuss GlyphLang
- GitHub Issues - Report bugs or request features
- Contributing Guide - Learn how to contribute to the project
Whether you are just getting started or have experience with GlyphLang, we encourage you to participate. No question is too small, and your feedback helps make GlyphLang better for everyone.
Contributions welcome! Please read CONTRIBUTING.md for guidelines.
By contributing, you agree to the Contributor License Agreement.
Apache License 2.0 - see LICENSE for details.