DeepLang

A Memory-Safe Programming Language for AIoT & Edge AI

DeepLang is a modern, memory-safe programming language designed for resource-constrained AIoT and edge AI environments. With a C-style syntax, strong static type system, and seamless WASM compilation, it empowers developers to build safe, efficient, and portable intelligence on the edge.

Language Features

Designed for safety and productivity in AIoT & edge AI development

πŸ›‘οΈ

Memory Safe

Borrow checker and ownership system inspired by Rust, preventing null pointer dereference, buffer overflow, and use-after-free bugs at compile time β€” critical for reliable edge AI inference.

πŸ”’

Strong Static Typing

Rich type system with algebraic data types (ADTs), pattern matching, interfaces, and type inference. A formal type checker ensures correctness before your code runs on-device.

πŸ“

C-Style Syntax

Familiar syntax for C/C++ developers, making it easy to learn and adopt. Curly braces, semicolons, and familiar control flow.

🧩

Multi-Paradigm

Supports procedural, object-oriented (via interfaces), and functional programming paradigms in one coherent language.

πŸ”Œ

Interface System

Static dispatch polymorphism through interfaces β€” no virtual tables, no runtime overhead. Clean separation of behavior and data.

🎯

Pattern Matching

Expressive pattern matching on ADTs, tuples, structs, and literals. Destructuring with compile-time exhaustiveness checking.

Compiler & Type System

An OCaml-powered compiler pipeline targeting WebAssembly

The DeepLang compiler frontend is implemented in OCaml, leveraging its powerful type system for correctness. It compiles DeepLang source code through a multi-stage pipeline into WebAssembly β€” the universal runtime for edge devices.

1
Lexer
Tokenizes source code
β†’
2
Parser
Builds AST from tokens
β†’
3
Semantic Walker
Type checking & symbol resolution
β†’
4
ANF Conversion
CPS-based normalization
β†’
5
WAT Codegen
Generates WASM text format

Type System Highlights

  • Formal type checker with ADT exhaustiveness verification
  • Pattern match compilation to ANF branching
  • Interface method table merging with inheritance support
  • Bump allocator memory model for predictable latency
  • Compile-to-WASM for portable edge deployment

Try DeepLang

ADT + Pattern Matching + Interfaces β€” the essence of DeepLang

geometry.dp
// Algebraic data type for geometric shapes
type Shape [
    Rectangle(width: F64, height: F64),
    Circle(radius: F64),
    Nothing
]

// Interface for area calculation
interface Area {
    fun area(this) -> F64;
}

// Implement Area for Shape using pattern matching
impl Area for Shape {
    fun area() -> F64 {
        match (this) {
            Rectangle(w, h) => { return w * h; }
            Circle(r)       => { return 3.14159 * r * r; }
            Nothing         => { return 0.0; }
        }
    }
}

fun main() -> () {
    let rect: Shape = Rectangle(3.0, 4.0);
    let circ: Shape = Circle(2.5);
    print(rect.area().toString());  // 12.0
    print(circ.area().toString());  // 19.6349
}

DeepVM

A lightweight virtual machine purpose-built for AIoT edge devices

DeepVM is the runtime that powers DeepLang on embedded and edge AI devices. With an ultra-compact footprint and native WASM support, it enables safe, efficient code execution on microcontrollers and AIoT chipsets.

≀ 100 KB ROM Footprint
≀ 50 KB RAM Usage
Native WASM Support
Built-in Interactive REPL

Supported Chips

  • Espressif ESP32 (AIoT)
  • Huawei HI3861
  • Loongson 1C0300B

Team

Students and researchers from leading universities

Zhejiang University (ZJU)
Core Contributor
USTC
Core Contributor
Imperial College London
Core Contributor

Interested in contributing? We welcome new members!