ZLang

The Language of the Gen Z - Try It Live!

Quick Examples

ZLang Code Editor

Output

// Click 'Run Code' to see output here

Gen Z Keywords Dictionary

Traditional ZLang (Gen Z) Category
letbetVariables
truefrLiterals
falsecapLiterals
ifsusConditionals
else iflowkey susConditionals
elseno susConditionals
switchvibecheckConditionals
forgrindLoops
whilelowkeyLoops
continueno chillControl Flow
breakslayControl Flow
functionflexFunctions
returnvibeFunctions
printbruhOutput
trymanifestError Handling
catchcaughtError Handling
throwdramaError Handling
finallyfrfrError Handling

🛠️ How ZLang Was Built

🤝 Want to Collaborate?

Help us improve ZLang! Contribute new features, fix bugs, or add more Gen Z slang to make it even better.

⭐ View on GitHub & Contribute

📚 Simple Explanation: How We Built ZLang

Step 1: Teaching the Computer Words

We taught the computer to recognize Gen Z slang as programming commands.

Example: When you type "bet name = 'Alex'"
Computer sees: bet (keyword) + name (identifier) + = (operator) + "Alex" (text)
Step 2: Understanding Grammar Rules

We built rules so the computer knows how words fit together.

Rules we taught:
bet [name] = [value] → Create variable
sus ([condition]) { [code] } → If statement
bruh [message] → Print output
Step 3: Making It Actually Work

We built an executor that does what the code says.

What happens:
1. You type: bet name = "Alex"
2. Computer stores: Alex → name
3. You type: bruh name
4. Computer prints: Alex
Step 4: Which Files Do What
src/lexer.rs
Recognizes words and symbols
src/parser.rs
Understands grammar rules
src/interpreter.rs
Actually runs your code
src/web_server.rs
Creates this website

🔧 Architecture Overview

ZLang is a complete programming language interpreter built entirely in Rust, featuring a three-stage compilation pipeline:

  • Lexical Analysis: Custom lexer tokenizes Gen Z slang into structured tokens
  • Parsing: Recursive descent parser builds Abstract Syntax Trees (AST)
  • Interpretation: Tree-walking interpreter executes the AST with environment management

🚀 Core Components

Lexer (src/lexer.rs):
  • Multi-word keyword recognition
  • String/number literal parsing
  • Error handling with line/column tracking
Parser (src/parser.rs):
  • Expression precedence handling
  • Control flow statement parsing
  • Function declaration support
Interpreter (src/interpreter.rs):
  • Environment scope management
  • Function call resolution
  • Error propagation system
Web Server (src/web_server.rs):
  • HTTP request handling
  • JSON API for code execution
  • Interactive web playground

💡 Key Features

Multi-word Keywords Real-time Execution Error Handling Function Support Control Flow Web Interface

🔬 Implementation Details

The language uses a tree-walking interpreter approach for simplicity and educational value. Multi-word keywords like "lowkey sus" and "no chill" are handled through a two-stage lexing process that first identifies the base word, then checks for continuation patterns. The environment system supports lexical scoping with a stack-based scope management system.

📦 Built With

🦀 Rust
📦 Cargo
🌐 HTTP Server
🎨 Web UI