Skip to content

JairusSW/Zep

Repository files navigation

███████ ███████ ██████  
   ███  ██      ██   ██ 
  ███   █████   ██████  
 ███    ██      ██      
███████ ███████ ██      

Zep

Zep is a TypeScript-inspired, statically typed programming language with clean syntax, powerful unions, structural typing, and a focus on developer ergonomics. Designed for simplicity and expressiveness.

npm License

✨ Features

  • TypeScript-like types: Unions (A | B), generics (<T>), structural records, type predicates
  • Clean syntax: fn name(a: i32): i32 { rt expr }, let x = 42, mut count: i32 = 0
  • Smart narrowing: if (x is string) { ... }, if (isUser(x)) { ... }
  • Borrowing & ownership: &T, &mut T, T* with Rust-inspired safety
  • Pattern matching: Exhaustive match with guards and destructuring
  • Go-style errors: (Result, Error | null) tuples
  • Attributes: #[export], #[extern("symbol")], #[inline]

💾 Installation

npm install zep

zep --help
zep run main.zep
zep build main.zep

🚀 Quick Start

main.zep

#[export]
fn add(a: i32, b: i32): i32 {
    rt a + b
}

#[export]
fn main(): void {
    let result = add(5, 3)
    print("Result: ", result)  // Result: 8
}
zep main.zep

📚 Core Syntax Highlights

Functions & Type Inference

fn parse(s: string): i32 | null {
    if (s is empty) { rt null }
    rt parse_int(s)
}

Unions & Narrowing

fn process(x: i32 | string | null) {
    if (x is null) { return }
    if (x is string) {
        // x: string here
        print(x)
    } else {
        // x: i32 here
        print_int(x)
    }
}

Structs with Defaults

struct User {
    id: i32
    name: string
    avatar: string | null = null
}

Borrowing & Pointers

fn get_length(s: &string): i32 {
    rt s.length
}

🛠️ Development

# Build from source
npm run build

# Run tests
npm test

# Format code
npm run format

📖 Documentation

You can find the language reference here: Language Reference

Full language reference: zep.jairus.dev

🤝 Contributing

Contributions welcome! See the contributing guidelines.

📃 License

This project is distributed under the MIT License.

📫 Contact

Please send all issues to GitHub Issues

About

Homebrew compiler built from the ground up

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published