A minimal systems programming language that compiles to native executables via C99.

Pascal/Oberon-inspired with automatic memory management, self-contained toolchain, and full Windows API access.

What is Pax?

Pax is a Pascal/Oberon-inspired systems programming language targeting Win64. It compiles to C via TinyCC with a completely self-contained toolchain—no external dependencies required.

Memory is automatically managed via the Boehm-Demers-Weiser Garbage Collector, freeing you from manual memory management while maintaining systems-level performance.

Configuration is handled through TOML files, providing a clean, readable format for build settings, C header import definitions, and general-purpose application configuration.

Win64 Native JIT Support Auto GC Self-Contained
HelloWorld.pax
module exe HelloWorld;

routine printf(const fmt: pointer to char; ...): int32; external 'msvcrt.dll';

var
  name: string;

begin
  name := 'Pax';
  printf('Hello from %s!\n', pointer to char(name));
  printf('GC heap: %lld bytes\n', gc_heapsize());
end.

Key Features

Everything you need to build Windows 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.

🧹

Automatic Memory

Boehm GC handles allocation and cleanup automatically.

📦

Self-Contained

Embedded TinyCC toolchain. Single executable distribution.

🪟

Windows Native

Call any DLL directly with full Windows API access.

🎛️

Multiple Outputs

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

JIT Compilation

Compile and execute code in memory without generating files.

🏛️

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.

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 Dynamic library
module jit In-memory execution

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
    printf('Cleanup done\n');
  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 on

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

begin
end.

test 'Addition works'
begin
  TestAssertEqualInt(5, Add(2, 3));
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 Windows applications with clean, readable code.