Free from legacy.
The next chapter in systems programming.

Lyx is not just another language. Native Linux x86_64, Linux ARM64 and Windows x64 binaries — without libc, without linker, pure syscalls and WinAPI.

Quick Start

Get started with Lyx in minutes.

TERMINAL
# Build compiler
make build

# Compile and run Linux program
./lyxc examples/hello.lyx -o hello
./hello

# Cross-compile for Windows
./lyxc examples/hello.lyx -o hello.exe --target=win64

# Debug flags
./lyxc examples/hello.lyx --emit-asm      # Output IR as pseudo-assembler
./lyxc examples/hello.lyx --dump-relocs   # Show relocations and symbols
./lyxc examples/hello.lyx --no-opt         # Disable IR optimizations

Output:

Hello Lyx

No LibC.
No Compromise.

While other languages rely on massive standard libraries, Lyx speaks directly to the Linux kernel and Windows API. Cross-compilation included.

  • Linux x86_64 + ARM64 + Windows x64 Cross-Compilation
  • Direct Syscall/WinAPI Communication
  • Complete Module System with std-Library
  • Minimal Binary Footprint (from 4KB)
Binary Size Complexity
Others (dynamically linked) ~800 KB
Lyx (statically native) 4-42 KB

Cross-Compilation

One codebase, six platforms. Lyx supports cross-compilation for Linux, Windows, macOS, and ESP32.

🐧

Linux x86_64

ELF64 binary with SysV ABI. Direct syscalls for maximum performance.

./lyxc app.lyx -o app
🍎

Linux ARM64

Raspberry Pi, Apple Silicon Linux, Cloud Servers

./lyxc app.lyx -o app --target=arm64
🪟

Windows x64

PE32+ binary with Windows x64 calling convention. Shadow space + IAT.

./lyxc app.lyx -o app.exe --target=win64
🍎

macOS x86_64

Intel Macs, Mach-O binary with BSD syscalls

./lyxc app.lyx -o app --target=macosx64
🍎

macOS ARM64

Apple Silicon Macs, M1/M2/M3 chips

./lyxc app.lyx -o app --target=macos-arm64
📟

ESP32

Xtensa microcontroller, GPIO, UART, built-in syscalls

./lyxc app.lyx -o app.elf --target=esp32
Target Format Calling Convention OS Interface Status
linux ELF64 SysV ABI (RDI, RSI, RDX, RCX, R8, R9) Syscalls Stable
arm64 ELF64 AAPCS64 (X0-X7) Syscalls Stable
win64 PE32+ Windows x64 (RCX, RDX, R8, R9 + Shadow Space) kernel32.dll Stable
macosx64 Mach-O SysV ABI BSD Syscalls Stable
macos-arm64 Mach-O AAPCS64 BSD Syscalls Stable
esp32 ELF32 Xtensa (A2-A7) GPIO, UART Experimental

Note: The --target parameter is optional. The compiler automatically selects the host OS as the target. The --arch parameter is also optional — architecture is automatically inferred from the target.

Architecture Parameter: --arch

You can also explicitly specify the architecture using --arch:

./lyxc app.lyx -o app --target=macosx64 --arch=x86_64
./lyxc app.lyx -o app --target=macos-arm64 --arch=arm64
./lyxc app.lyx -o app --target=esp32 --arch=xtensa
--arch=x86_64
64-bit x86 (Intel/AMD)
--arch=arm64
64-bit ARM (Apple Silicon)
--arch=xtensa
Xtensa (ESP32)

Testing ARM64 binaries on x86_64:

# Install QEMU
sudo apt install qemu-user-static

# Run ARM64 binary
qemu-aarch64-static ./program

Why Lyx?

The freedom of directness. In a world where modern languages often carry huge runtimes and complex dependencies, Lyx returns to the roots of systems programming — without sacrificing modern syntax.

Zero Dependencies

True binary independence. Most languages rely on the C standard library or external linkers. Lyx breaks this tradition.

  • Direct ELF64 and PE32+ generation
  • No libc binding, direct syscalls
  • Single-toolchain: only lyxc needed
🔗

External Functions

You're not isolated. Lyx supports integration of external libraries when you need them.

  • extern fn extern fn for libc/libm integration
  • Linux .so and Windows .DLL support
  • PLT/GOT for dynamic linking
  • Varargs: printf(fmt, ...)
🔒

Safety through Typing

Lyx is not a loose scripting language. It's built for systems you can rely on.

  • No implicit casts — errors nipped in the bud
  • var, let, co, con storage classes
  • Full control over mutability

The Best of Three Worlds

Lyx combines the strengths of established languages into something new.

  • C — C — The power of systems programming
  • Rust — Rust — Safety approaches and strict typing
  • Pascal — Pascal — Clarity and readability of syntax

Data Types

Complete type system with strict typing and no implicit casts.

Category Types Description
Signed Integer int8 int16 int32 int64 Signed 8/16/32/64-bit integers. int = int64
Unsigned Integer uint8 uint16 uint32 uint64 Unsigned 8/16/32/64-bit integers. uint = uint64
Floating Point f32 f64 32-bit and 64-bit IEEE 754 floating point
Pointer pchar pchar? Non-nullable (default) and nullable pointers. pchar = null-terminated string
Boolean bool true / false
Special void usize isize Void return, unsigned/isigned size_t
Arrays array parallel Array<T> Stack-allocated and SIMD-optimized heap arrays
Map & Set Map<K,V> Set<T> Associative arrays with O(n) lookup
QBool QBool Probabilistic boolean (0.0 to 1.0)
🔄

Type Casting

Explicit casting with as operator.

var f: f64 := 42 as f64;
var i: int64 := 3.14 as int64;

Nullable Types

Pointer types can be nullable with ?

var p: pchar? := null;
var q: pchar := p ?? "fallback";

SIMD Arrays

parallel Array for vectorized operations.

var v: parallel Array<Int64>;
var sum := v + v; // SIMD

Use Cases

What can you build with Lyx?

🖥️

Systems Programming

Direct hardware access, drivers, operating system components. Full control without abstraction overhead.

☁️

Cloud-Native

Minimal container images, microservices, Kubernetes-ready. Ultra-small binaries for maximum density.

🔌

Embedded Systems

Minimal footprint starting at 4KB, no runtime required. Perfect for constrained environments.

📚

Education

Clear, readable syntax inspired by Pascal. Perfect for learning systems programming concepts.

MAIN.LYX
import std.math;

type Point = struct {
    x: int64;
    y: int64;
};

fn main(): int64 {
    // Struct literal with fields
    var p: Point := Point { x: 10, y: 20 };
    
    // Pipe operator and standard library
    let result: int64 := -42 |> Abs64();
    
    PrintInt(p.x + result);  // 52
    return 0;
}

Advanced Language Features

Powerful features for modern systems programming

📊

Global Variables

Declare variables at top-level for global state.

var globalCounter: int64 := 0;
let maxSize: int64 := 1024;

fn increment() {
  globalCounter := globalCounter + 1;
}

Compile-Time Constants

Use con for compile-time constants - no stack allocation.

con LIMIT: int64 := 5;
con MSG: pchar := "Loop\n";

fn main(): int64 {
  while (i < LIMIT) { ... }
}
🎲

QBool - Probabilistic Boolean

Quantum-like boolean type (0.0 to 1.0 probability).

import std.qbool;

var is_rainy: QBool := Maybe(0.7);
var will_stay_home: QBool := QBoolAnd(is_rainy, is_cold);
var decision: bool := Observe(will_stay_home);
🗺️

Maps & Sets

Associative arrays for key-value storage.

var scores: Map<int64, int64> := {1: 100, 2: 200};
scores[3] := 300;
if (1 in scores) { ... }

var ids: Set<int64> := {10, 20, 30};
🔄

Virtual Methods & VMT

OOP with polymorphism via Virtual Method Tables.

type Animal = class {
  virtual fn speak();
};

type Dog = class extends Animal {
  override fn speak() { ... }
};
📝

std.log - Logging

Built-in logging with levels: DEBUG, INFO, WARN, ERROR.

import std.log;

log_info("Starting app...");
log_warn("Low memory");
log_error("Connection failed");
🖥️

std.os - System Functions

OS-level access: process, environment, time, filesystem.

import std.os;

var pid: int64 := get_pid();
var home: pchar := env_get("HOME");
var t: int64 := time_ms();
sleep(100);
🔧

30+ Builtins

No imports needed for common operations.

PrintStr, PrintInt, PrintFloat
Random, RandomSeed
push, pop, len, free
abs, sqrt, sin, cos
StrLength, str_to_int

Compiler Architecture

From source code to native executable in 8 stages

Source (.lyx)
Lexer → Token-Stream
Parser → AST
Sema → Scopes, Types
IR Lowering → 3-Address-Code
IR Optimizer → CSE, DCE, Copy Prop
Inlining → Function Inlining
Backend → Machine Code
Linux x86_64
Linux ARM64
Windows x64
macOS x86_64
macOS ARM64
ESP32
Executable (no libc)
ELF64
Linux x86_64/ARM64
PE32+
Windows x64
Mach-O
macOS x86_64/ARM64
ELF32
ESP32
IR Optimizer
CSE, DCE, Copy Prop
Inlining
Function Inlining

Energy-Aware Optimization

Lyx optimizes for energy efficiency with configurable energy levels and per-function pragmas

CLI Option

--target-energy=<1-5>
1 = Minimal (battery-optimized)
2 = Low
3 = Medium (balanced, default)
4 = High
5 = Extreme (max performance)

Function Pragma

@energy(1)
fn low_power_task() { ... }

@energy(5)
fn hot_path() { ... }
Override energy level per function for mixed workloads

What gets optimized?

Loop Unrolling
1× to 8× based on level
SIMD Usage
Level 3+ enables SIMD
FPU Operations
Level 4+ enables FPU
AVX2/512
Level 5 + CPU support

In-Situ Data Visualizer

Inspect any variable at runtime with zero setup. Output goes directly to stderr.

Inspect() Demo

Drop Inspect() anywhere in your code for instant debugging.

debug.lyx
fn main(): int64 {
    var count: int64 := 42;
    var isActive: bool := true;
    var message: pchar := "Hello, Debug!";
    
    // Inspect any variable at runtime
    Inspect(count);      // Outputs to stderr
    Inspect(isActive);
    Inspect(message);
    
    return 0;
}

Output Preview

Here is what Inspect() outputs for various types:

=== count ===
Type: int64
Value: 42

=== isActive ===
Type: bool
Value: true

=== message ===
Type: pchar
Value: Hello, Debug!

Supported Types

Inspect automatically detects and formats:

int64 int32 uint8 bool pchar f32 f64

Integrated Linter

10 built-in rules help you write cleaner, safer code from the start.

CLI Flags

# Enable linter (default)
./lyxc program.lyx --lint
# Disable linter warnings
./lyxc program.lyx --no-lint
# Lint only, do not compile
./lyxc program.lyx --lint-only

Linting Rules

The integrated linter checks your code for common issues:

1 Unused Variables
2 Type Mismatches
3 Dead Code
4 Naming Conventions
5 Redundant Casts
6 Unsafe Operations
7 Shadowing
8 Missing Returns
9 Constant Comparisons
10 Inefficient Patterns

IR-Level Optimizer

Multiple optimization passes produce faster, smaller code.

Constant Folding

Evaluates constant expressions at compile time.

x := 2 + 4x := 6

Common Subexpression Elimination

Eliminates redundant computations.

a := x + y
b := x + y
reuse

Dead Code Elimination

Removes unreachable code and unused functions.

if false { dead(); }
removed

Copy Propagation

Replaces copies with direct value use.

a := b
c := a
c := b

Strength Reduction

Replaces expensive operations with cheaper ones.

x * 2x << 1
x / 2x >> 1

Peephole Optimizer

Local optimizations: identity ops, redundant moves.

mov rax, rax
removed

Function Inlining

Inline small functions to reduce call overhead.

fn add(a, b: int64): int64 {
return a + b;
}
// becomes:
inlined at call site

Optimization Result

Smaller code = faster execution = lower energy

Standard Library

Comprehensive built-in libraries — no external dependencies required.

std.math
Mathematical functions
Abs64, Min64, Max64, Sqrt64, Clamp64, Sign64, Lerp64, Map64, Sin64, Cos64, Hypot64, IsEven, IsOdd, NextPowerOfTwo
std.io
I/O functions
print, PrintLn, PrintIntLn, ExitProc, Printf
std.string
String manipulation
StrLength, StrCharAt, StrFind, StrToLower, StrToUpper, StrConcat, StrReplace
std.env
Environment API
ArgCount, Arg, init
std.time
Date and time
Numerical calculations, timezone support
std.geo
Geolocation
Decimal Degrees, GeoPoint, Distance, BoundingBox
std.fs
Filesystem operations
open, read, write, close, file existence
std.crt
ANSI Terminal
Colors, cursor control
std.pack
Binary serialization
VarInt, int/float/string packing
std.regex
Regex matching
Full regex engine included
std.qbool
Probabilistic Boolean
QBool, Maybe(), Observe(), Entanglement
std.vector
2D Vector library
Vec2
std.list
Collections
StaticList8, StackInt64, QueueInt64, RingBufferVec2
std.rect
Rectangle utilities
Rect
std.color
RGBA Color utilities
Color manipulation

Simplicity is the
highest form of perfection.

v0.5.0 Feature

OOP — Complete

Classes with inheritance, constructors, destructors. Heap allocation with new/dispose. super for base class calls.

  • class extends for Single Inheritance
  • new ClassName(args) with constructor
  • dispose obj calls Destroy()
  • super.method() for base class
type
Dog = class extends Animal {
breed: pchar;
fn Create(n, b: pchar) {
self.name := n;
self.breed := b;
}
fn speak() {
PrintStr("Woof!\n");
}
};

Cross-Compilation

Linux x86_64, Linux ARM64 and Windows x64 aus einem Codebase. Ein Compiler, drei Plattformen.

Module System

Complete Import/Export with Standard Library.