Skip to content

solnix-lang/solnix-docs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solnix Documentation

Overview

Solnix is a systems programming language designed specifically for eBPF (extended Berkeley Packet Filter) program development. It provides a high-level syntax for writing eBPF programs while generating efficient C code compatible with the libbpf ecosystem.

Key Features

  • eBPF-Specific Syntax: Purpose-built constructs for common eBPF patterns
  • Type Safety: Static typing with eBPF-aware type checking
  • libbpf Integration: Generates C code compatible with libbpf and vmlinux.h

Language Goals

Solnix aims to simplify eBPF development by providing a more accessible syntax than raw C while maintaining compatibility with the established libbpf ecosystem. The compiler generates standard eBPF C code that can be compiled with clang and loaded using standard Linux tools.

Implementation

Solnix is implemented in Rust and consists of three main repositories:

  • solnix-compiler: Core compiler implementation with lexer, parser, semantic analysis, and C code generation
  • solnix-cli: Command-line interface and build tooling
  • solnix-docs: Language specification and architectural documentation

Getting Started

Prerequisites

  • Rust 1.70+ with Cargo
  • Clang 11+ with BPF target support
  • Linux kernel 4.18+ with eBPF support
  • libbpf development headers (for vmlinux.h)

Basic Usage

# Compile a Solnix program
solnix build program.snx

# Load into kernel (XDP example)
sudo ip link set dev eth0 xdp obj program.o

Example Program

map packet_counter {
    type: .hash;
    key: u32;
    value: u64;
    max: 1024;
}

unit xdp_filter {
    section: "xdp";
    license: "GPL";

    reg src_ip = ctx.load_u32(26);
    heap count_ptr = packet_counter.lookup(src_ip);

    if guard(count_ptr) {
        *count_ptr += 1;
    }

    return 1;
}

Project Status

Solnix is in early development with a working compiler that generates libbpf-compatible C code.

Contributing

Contributions are welcome. Please refer to the architecture documentation for implementation details and design rationale.

About

Solnix Documentation

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages