A minimal systems programming language with seamless C++ interoperability.

Pascal/Oberon-inspired syntax, compiling to native executables via C++23. Cross-platform targeting Windows, Linux, and macOS.

What is Pax?

Pax is a Pascal/Oberon-inspired systems programming language with seamless C++ interoperability. Write Pax code alongside C++ in the same source files—use #include, call C++ functions, and use C++ types directly.

Pax compiles to C++23 via Zig's bundled Clang, providing a completely self-contained toolchain with cross-platform targeting for Windows, Linux, and macOS.

The core philosophy: "If it's not Pax, it's C++—pass through verbatim." This enables gradual adoption and full access to the C++ ecosystem.

Cross-Platform C++ Interop C++23 Self-Contained
HelloWorld.pax
module exe HelloWorld;

var
  name: string;

begin
  name := 'Pax';
  writeln('Hello from {}!', name);
  writeln('Welcome to systems programming.');
end.

Key Features

Everything you need to build cross-platform applications with clean, readable code.

🎯

Minimal by Design

Clean syntax with no redundancy. Just what you need, nothing more.

📖

Pascal Heritage

Readable, structured code inspired by Pascal and Oberon traditions.

🧹

Explicit Memory

Full control with getmem/freemem. No hidden allocations.

📦

Zig Toolchain

Self-contained Zig/Clang compiler. No external dependencies.

🪟

Cross-Platform

Target Windows, Linux, and macOS from a single codebase.

🎛️

Multiple Outputs

Build executables, DLLs, or static libraries from one codebase.

C++ Interop

Use #include, call C++ functions, use C++ types directly.

🏛️

Classes & Records

Methods, inheritance, and virtual dispatch with type extension.

📊

Dynamic Arrays

setlength/len with automatic memory management.

📝

Managed Strings

UTF-8 and UTF-16 string types with emoji support.

🧪

Built-in Testing

Integrated unit test framework with assertions.

⚠️

Exception Handling

try/except/finally with OS exception support.

🧠

LSP Tooling

Full Language Server Protocol with completions, hover, go-to-definition, rename, and more.

🐛

Source Debugging

LLDB-DAP debugger with breakpoints, stepping, variable inspection, and interactive REPL.

Language Overview

A comprehensive type system designed for systems programming.

Built-in Types

Type Size Description
int8 ... int64 1-8 bytes Signed integers
uint8 ... uint64 1-8 bytes Unsigned integers
float32, float64 4-8 bytes Floating point
boolean 1 byte true / false
string, wstring 8 bytes UTF-8 / UTF-16
pointer to T 8 bytes Typed pointers

Module Types

Declaration Output Description
module exe .exe Executable program
module lib .a Static library
module dll .dll/.so/.dylib Dynamic library

Code Examples

See how Pax handles common programming patterns.

Records & Inheritance

type
  TPoint = record
    x: int32;
    y: int32;
  end;

  TColorPoint = record(TPoint)
    color: uint32;
  end;

var
  p: TColorPoint;

begin
  p.x := 100;
  p.y := 200;
  p.color := $FF0000;
end.

Classes with Methods

type
  TCounter = class
    Count: int32;
    
    method Increment();
    begin
      Self.Count := Self.Count + 1;
    end;
    
    method GetCount(): int32;
    begin
      return Self.Count;
    end;
  end;

var
  c: pointer to TCounter;

begin
  new(c);
  c.Increment();
end.

Dynamic Arrays

var
  numbers: array of int32;
  i: int32;

begin
  setlength(numbers, 10);
  
  for i := 0 to len(numbers) - 1 do
    numbers[i] := i * 2;
  end;
end.

Exception Handling

var
  result: int32;

begin
  try
    raiseexception('Error!');
    result := 1;
  except
    result := 0;
  finally
    writeln('Cleanup done');
  end;
end.

Windows API Calls

module exe WinAPI;

routine MessageBoxW(
  hwnd: pointer; 
  text: pointer to wchar; 
  caption: pointer to wchar; 
  utype: uint32
): int32; external 'user32.dll';

begin
  MessageBoxW(nil, 
    L'Hello from Pax!', 
    L'Pax', 0);
end.

Unit Testing

module exe MyTests;

$unittestmode

routine Add(const a: int32; 
  const b: int32): int32;
begin
  return a + b;
end;

begin
end.

test 'Addition works'
begin
  TestAssertEqual(5, Add(2, 3));
end;

Developer Tooling

Professional IDE integration and source-level debugging out of the box.

🧠

Language Server Protocol

Pax ships with a full LSP implementation that works with VS Code, Neovim, Sublime Text, and any LSP-compatible editor. Get real-time feedback as you type.

  • Real-time diagnostics
  • Code completions
  • Hover information
  • Go to definition
  • Find all references
  • Rename symbol
  • Signature help
  • Document symbols
  • Semantic highlighting
  • Inlay hints
  • Call hierarchy
  • Code formatting
// VS Code settings.json
{
  "languageServer": {
    "pax": {
      "command": "path/to/PaxLSP.exe",
      "filetypes": ["pax"]
    }
  }
}
🐛

Source-Level Debugger

Debug your Pax code at the source level using LLDB-DAP. Set breakpoints directly in .pax files, step through code, and inspect variables—all mapped back from the generated C++.

  • Source breakpoints
  • Step over / into / out
  • Variable inspection
  • Expression evaluation
  • Call stack view
  • Multi-thread support
  • Interactive REPL
  • Restart & relaunch
var
  LValue: int32;

begin
  LValue := 40;
  $breakpoint          // debugger pauses here
  LValue := LValue + 2;
  writeln("Answer: {}", LValue);
end.

Getting Started

Create and run your first Pax project in seconds.

1

Create Project

Initialize a new Pax project with one command.

pax init MyProject
2

Write Code

Edit src/MyProject.pax with your favorite editor.

cd MyProject
3

Build & Run

Compile and execute in one step.

pax run

Ready to Try Pax?

Join our community of developers building cross-platform applications with clean, readable code.