Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Releases: tinyBigGAMES/PaxLang

πŸš€ Pax v0.1.0: Proof of Concept

07 Jan 00:48

Choose a tag to compare

TL;DR

Pax v0.1.0 proves that a fully self-contained compiler architecture works. By virtualizing libtcc's I/O through ZipVFS and IAT hooking, we've built a complete systems programming language that ships as a single executable with zero external dependencies.

This release isn't just about the architecture β€” it's about what the architecture enables. Every feature listed below works through this self-contained backend.

πŸ—οΈ The Architecture

The core challenge: TinyCC (libtcc) expects real filesystem access for headers, runtime files, and libraries. The solution: intercept those calls and serve embedded resources transparently.

Component Purpose
ZipVFS Virtual file system serving embedded toolchain resources
IAT Hooking Intercepts file I/O calls, redirects to ZipVFS
Embedded libtcc TinyCC compiler backend, no external installation
Embedded Boehm GC Automatic memory management, bundled

The result: A single pax.exe that contains everything needed to compile Pax programs. No PATH configuration. No SDK installation. No external dependencies.

✨ The Proof

Every feature below demonstrates that this architecture is production-viable.

Module System

Five module types, all working through the virtualized backend:

module exe MyApp;      // Executable program
module dll MyPlugin;   // Dynamic library
module lib MyUtils;    // Static library
module jit Script;     // JIT compilation (in-memory)
module jitlib Helpers; // JIT library (importable)

Module imports with qualified symbol access:

module exe Demo;

import Console;
import Maths, Strings;

begin
  Console.PrintLn('sqrt(2) = %g', Maths.Sqrt(2.0));
  Console.PrintLn('%s', Strings.UpperCase('hello'));
end.

Records with 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 Virtual Dispatch

type
  TAnimal = class
    method Speak();
    begin
      printf('Animal speaks\n');
    end;
  end;
  
  TDog = class(TAnimal)
    method Speak();
    begin
      parent.Speak();
      printf('Dog barks!\n');
    end;
  end;

var
  dog: pointer to TDog;

begin
  new(dog);
  dog.Speak();  // Animal speaks / Dog barks!
end.

Method and Routine Overloading

routine Print(const s: pointer to char);
begin
  printf('String: %s\n', s);
end;

routine Print(const n: int32);
begin
  printf('Int32: %d\n', n);
end;

routine Print(const f: float64);
begin
  printf('Float: %f\n', f);
end;

begin
  Print('Hello');  // String: Hello
  Print(42);       // Int32: 42
  Print(3.14);     // Float: 3.14
end.

Unions and Packed Records

type
  TValue = union
    asInt: int64;
    asFloat: float64;
    asPtr: pointer;
  end;

  THeader = record packed
    magic: uint16;
    version: uint8;
    flags: uint8;
  end;

  TFlags = record packed
    enabled: uint8 : 1;
    priority: uint8 : 3;
    reserved: uint8 : 4;
  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.

Sets with Ranges

type
  TDays = set of 0..6;

var
  weekdays: TDays;
  weekend: TDays;
  today: int32;

begin
  weekdays := {1, 2, 3, 4, 5};
  weekend := {0, 6};
  
  today := 3;
  if today in weekdays then
    printf('Weekday\n');
  end;
end.

Managed Strings

var
  path: string;
  msg: wstring;

begin
  path := @'C:\Users\Name\file.txt';  // Raw string
  msg := L'Hello World! πŸŽ‰';           // Wide string with emoji
  
  if path = @'C:\Users\Name\file.txt' then
    printf('String comparison works\n');
  end;
end.

Exception Handling

var
  p: pointer to int32;

begin
  // Software exceptions
  try
    raiseexception('Something went wrong');
  except
    printf('Caught: %s\n', pointer to char(getexceptionmessage()));
  end;
  
  // OS exceptions (access violation)
  try
    p := nil;
    p^ := 42;
  except
    printf('Caught: 0x%08X\n', getexceptioncode());
  end;
  
  // Finally blocks
  try
    riskyOperation();
  finally
    cleanup();  // Always runs
  end;
end.

External DLL Calls

module exe WinAPI;

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

routine c_sqrt(const x: float64): float64; external 'msvcrt.dll' name 'sqrt';

begin
  MessageBoxW(nil, L'Hello from Pax!', L'Pax', 0);
  printf('sqrt(2) = %f\n', c_sqrt(2.0));
end.

Native Variadic Routines

routine SumAll(...): int64;
var
  i: int32;
  total: int64;
begin
  total := 0;
  for i := 0 to len(VarArgs) - 1 do
    total := total + VarArgs[i].vint;
  end;
  return total;
end;

begin
  printf('Sum: %lld\n', SumAll(10, 20, 30, 40));  // Sum: 100
end.

JIT Compilation

Compile and execute in memory β€” no files generated:

module jit Calculator;

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

var
  x: int32;
  y: int32;

begin
  x := 10;
  y := 20;
  printf('x + y = %d\n', x + y);
  printf('x * y = %d\n', x * y);
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));
  TestAssertEqualInt(0, Add(-1, 1));
end;

C Header Importer

Convert C headers to Pax modules automatically:

LImporter := TPaxCImporter.Create();
try
  LImporter.SetModuleName('sdl3');
  LImporter.SetDllName('sdl3.dll');
  LImporter.SetOutputPath('libs/sdl3/src');
  LImporter.AddIncludePath('libs/sdl3/include');
  LImporter.SetHeader('libs/sdl3/include/sdl3/sdl.h');
  LImporter.Process();
finally
  LImporter.Free();
end;

Version Info and Icons

module exe MyApp;

#subsystem gui
#addverinfo yes
#vimajor 1
#viminor 0
#vipatch 0
#viproductname 'My Application'
#videscription 'A sample Pax application'
#vicompanyname 'My Company'
#vicopyright 'Copyright 2025'
#exeicon @'assets\app.ico'

begin
end.

πŸ“š Standard Library

Module Description
Console I/O with ANSI colors, cursor control
Maths Trig, logarithms, rounding, random, interpolation
Strings Case conversion, trimming, searching, padding
Convert Type conversions (int, float, bool, hex)
Geometry Points, rects, sizes (integer and float)
Assertions Testing utilities with colored output
DateTime Date and time operations
Files File I/O operations
Paths Path manipulation utilities
Memory Memory operations

πŸ–₯️ CLI Tooling

# Create a new project
pax init MyGame

# Build the project
pax build

# Build and run
pax run

# Clean generated files
pax clean

# Version info
pax version

Project types: exe (default), lib, dll

πŸš€ Getting Started

Requirements

  • Windows 10 or later (64-bit)
  • That's it. No SDK. No toolchain installation.

Installation

  1. Download the release from GitHub
  2. Extract to a folder
  3. Add to PATH (optional)
  4. Run: pax version

Hello World

pax init HelloWorld
cd HelloWorld
pax run
module exe HelloWorld;

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

begin
  printf('Hello from Pax!\n');
end.

🌐 Community

🎯 The Bottom Line

Pax v0.1.0 β€” Proof of Concept

We set out to prove that a self-contained compiler architecture could work. This release is that proof.

βœ… ZipVFS + IAT hooking virtualizes libtcc's I/O
βœ… Single executable, zero external dependencies
βœ… Full module system (exe, dll, lib, jit, jitlib)
βœ… Records with inheritance, classes with virtual dispatch
βœ… Method and routine overloading
βœ… Unions, packed records, bit fields
βœ… Dynamic arrays, sets, managed strings
βœ… Exception handling with OS exception support
βœ… External DLL calls with varargs
βœ… JIT compilation
βœ… Unit testing framework
βœ… C header importer
βœ… Standard library
βœ… CLI tooling

The architecture works. The features work. Proof of concept complete.

File Integrity

Files are signed with minisign using this public key:
RWQqjFkbJ5MpCO03yJuQV8NBQGP5iGhb4nxIbw31Oa0ctj3nWi75Zoll


Paxβ„’ Programming Language.

Copyright Β© 2025-present tinyBigGAMESβ„’ LLC. All Rights Reserved.