Skip to content

Releases: tinyBigGAMES/NitroPascal

NitroPascal v0.4.0

20 Oct 00:01

Choose a tag to compare

🚀 NitroPascal v0.4.0: Real-World Usage

TL;DR

NitroPascal v0.4.0 proves real-world viability with function pointers, structured RTL modules (Types, SysUtils, StrUtils, DateUtils), static library linking (raylib example included), performance benchmarks showing competitive results against Delphi, and a dramatically expanded C++ runtime. You can now build, benchmark, and ship production applications with confidence.

🎯 The Real-World Milestone

This release isn't about adding more features - it's about proving NitroPascal works in production. You can now:

Use function pointers - Callbacks, event handlers, higher-order functions
Link static libraries - Demonstrated with raylib game development library
Structure with RTL modules - Types, SysUtils, StrUtils, DateUtils
Benchmark performance - Comprehensive NitroPascal vs Delphi comparison
Ship single executables - No DLL dependencies with static linking
Build real apps - Complete toolkit for production software

🔥 What's New in v0.4.0

Function Pointers - Callbacks and Events

The big feature request is here. Function pointers (procedural types) enable callbacks, event-driven programming, and functional patterns:

type
  TCompareFunc = function(const A, B: Integer): Integer;
  TNotifyProc = procedure(const Msg: String);

procedure QuickSort(var A: array of Integer; Compare: TCompareFunc);
var
  I, J, Pivot: Integer;
begin
  if Length(A) <= 1 then Exit;
  
  Pivot := A[Length(A) div 2];
  I := 0;
  J := High(A);
  
  while I <= J do
  begin
    while Compare(A[I], Pivot) < 0 do Inc(I);
    while Compare(A[J], Pivot) > 0 do Dec(J);
    if I <= J then
    begin
      Swap(A[I], A[J]);
      Inc(I);
      Dec(J);
    end;
  end;
  
  if J > 0 then QuickSort(Copy(A, 0, J + 1), Compare);
  if I < High(A) then QuickSort(Copy(A, I, Length(A) - I), Compare);
end;

function Ascending(const A, B: Integer): Integer;
begin
  Result := A - B;
end;

function Descending(const A, B: Integer): Integer;
begin
  Result := B - A;
end;

var
  Numbers: array of Integer;
begin
  SetLength(Numbers, 5);
  Numbers[0] := 5; Numbers[1] := 2; Numbers[2] := 8;
  Numbers[3] := 1; Numbers[4] := 9;
  
  // Sort ascending
  QuickSort(Numbers, @Ascending);
  
  // Sort descending
  QuickSort(Numbers, @Descending);
end.

Use cases:

  • Event handlers in GUI frameworks
  • Callbacks in async operations
  • Sorting with custom comparisons
  • Plugin architectures
  • Functional programming patterns
  • Framework integration hooks

Static Library Linking - Ship Single Executables

Want to distribute a single .exe with no dependencies? Static linking is here, demonstrated with raylib:

program RaylibGame;

{$link raylib}
{$library_path './lib'}

// Raylib functions via static linking
procedure InitWindow(Width, Height: Integer; Title: PAnsiChar); 
  cdecl; external 'raylib.lib';
procedure CloseWindow(); cdecl; external 'raylib.lib';
function WindowShouldClose(): Boolean; cdecl; external 'raylib.lib';
procedure BeginDrawing(); cdecl; external 'raylib.lib';
procedure EndDrawing(); cdecl; external 'raylib.lib';
procedure ClearBackground(Color: Integer); cdecl; external 'raylib.lib';
procedure DrawText(Text: PAnsiChar; X, Y, Size, Color: Integer); 
  cdecl; external 'raylib.lib';

begin
  InitWindow(800, 450, 'NitroPascal + Raylib!');
  
  while not WindowShouldClose() do
  begin
    BeginDrawing();
    ClearBackground(RAYWHITE);
    DrawText('Congrats! You created your first window!', 190, 200, 20, DARKGRAY);
    EndDrawing();
  end;
  
  CloseWindow();
end.

This is a complete, working game window that compiles to a single executable with raylib statically linked. No DLLs to ship. Just one .exe file.

Benefits:

  • Single-file deployment
  • No DLL versioning issues
  • Simplified distribution
  • Faster load times
  • Reduced attack surface

Structured RTL Modules - Professional Organization

The Runtime Library is now organized into standard Pascal modules for discoverability and maintainability:

Types - Base type declarations:

uses Types;
// Foundation types and utilities

SysUtils - System utilities and conversions:

uses SysUtils;

var
  S: String;
  I: Integer;
  F: Double;
begin
  // String conversions
  S := IntToStr(42);
  I := StrToInt('123');
  F := StrToFloat('3.14');
  
  // String manipulation
  S := UpperCase('hello');
  S := Trim('  spaces  ');
  S := StringReplace('test', 't', 'T', [rfReplaceAll]);
  
  // File system
  if FileExists('config.ini') then
    ProcessConfig();
end.

StrUtils - Advanced string manipulation:

uses StrUtils;

var
  S: String;
begin
  S := StringOfChar('*', 40);  // '****************************************'
  S := LeftStr('Hello', 3);    // 'Hel'
  S := RightStr('World', 3);   // 'rld'
end.

DateUtils - Date/time functions (foundation):

uses DateUtils;
// Date/time operations (initial implementation)

This modular organization makes the API discoverable, maintainable, and familiar to Delphi developers.

Performance Benchmarks - Competitive Results

The included benchmark suite provides quantitative comparison between NitroPascal and Delphi:

Test scenarios:

  • String operations (concatenation, manipulation, conversions)
  • Array operations (creation, access, iteration)
  • Mathematical computations (loops, calculations)

Results show NitroPascal delivers competitive performance thanks to:

  • LLVM optimization pipeline
  • Efficient C++ code generation
  • Optimized RTL implementation
  • Native compilation via Zig

Run the benchmarks yourself (bin folder):

NPBench_Delphi.exe (compiled in Delphi)
NPBench.exe (compiled in NitroPascal)

Enhanced String Library - Complete Unicode Support

New string functions for advanced manipulation and wide character support:

var
  S: String;
  Ch: Char;
  Buffer: array[0..255] of WideChar;
begin
  // Create repeated character strings
  S := StringOfChar('=', 80);  // '===============....'
  
  // Character case conversion
  Ch := UpCase('a');  // 'A'

  // Numeric to string (legacy format)
  Str(42:4, S);      // '  42' (width 4)
  Str(3.14:6:2, S);  // '  3.14' (width 6, precision 2)
  
  // Wide character operations
  WideCharToString(Buffer);
  StringToWideChar(S, Buffer, 256);

  // Direct buffer to string conversion
  SetString(S, @Buffer[0], WideCharLen(Buffer));
end.

Expanded Math Library - Scientific Computing

Complete mathematical toolkit for scientific and engineering applications:

var
  X, Y, Result: Double;
begin
  // Logarithms
  Result := Ln(2.718);      // Natural log
  Result := Log10(100);     // Base-10 log (2.0)
  Result := Log2(8);        // Base-2 log (3.0)
  Result := LogN(3, 27);    // Custom base log (3.0)
  
  // Exponential and power
  Result := Exp(1.0);       // e^1 ≈ 2.718
  Result := Power(2, 10);   // 2^10 = 1024
  
  // Integer and fractional parts
  Result := Int(3.7);       // 3.0
  Result := Frac(3.7);      // 0.7
  
  // Hyperbolic functions
  Result := Sinh(1.0);      // Hyperbolic sine
  Result := Cosh(1.0);      // Hyperbolic cosine
  Result := Tanh(1.0);      // Hyperbolic tangent
  Result := ArcSinh(0.5);   // Inverse hyperbolic sine
  Result := ArcCosh(1.5);   // Inverse hyperbolic cosine
  Result := ArcTanh(0.5);   // Inverse hyperbolic tangent
  
  // Angle calculations
  Result := ArcTan2(1.0, 1.0);  // Proper quadrant-aware arctangent
  
  // Mathematical constants
  Result := Pi;             // 3.14159265358979323846...
end.

Enhanced File I/O - Complete Delphi Compatibility

New file operations for complete Delphi text file compatibility:

var
  F: TextFile;
  Ch: Char;
  Line: String;
  ErrorCode: Integer;
begin
  Assign(F, 'data.txt');
  Reset(F);
  try
    // Character-by-character reading
    while not Eof(F) do
    begin
      Read(F, Ch);
      if Eoln(F) then
        WriteLn('End of line reached');
    end;
    
    // Skip whitespace and test for end
    Reset(F);
    SeekEof(F);   // Skip whitespace, check EOF
    SeekEoln(F);  // Skip whitespace, check EOL
    
    // Force write
    Flush(F);
    
    // Truncate at current position
    Truncate(F);
    
    Close(F);
    
    // File operations on closed file
    Erase(F);                    // Delete file
    Rename(F, 'newname.txt');    // Rename file
    
    // Check I/O errors
    ErrorCode := IOResult;
    if ErrorCode <> 0 then
      WriteLn('I/O Error: ', ErrorCode);
  except
    Close(F);
  end;
end.

Enhanced Memory Functions - Efficient Operations

Type-specific fill operations for better performance:

var
  ByteArray: array[0..99] of Byte;
  WordArray: array[0..99] of Word;
  DWordArray: array[0..99] of Cardinal;
  P: Pointer;
begin
  // Zero-filled allocation
  P := AllocMem(1024);  // Allocate and zero-fill
  try
    // Work with memory
  finally
    FreeMem(P);
  end;
  
  // Type-specific fills (more efficient than FillChar)
  FillByte(ByteArray, Length(ByteArray), $FF);
  FillWord(WordArray, Length(WordArray), $FFFF);
  FillDWord(DWordArray, Length(DWordArray), $FFFFFFFF);
end.

Code Generation Improvements - Better Debugging

Source position tracking in generated C++ code:

// Original Pascal code at line 42
WriteLn('Hello');

Generates:

#line 42 "myprogram.pas"
np::WriteLn(u"Hello");

Benefits:

  • Error messages reference original Pascal source lines
  • Debugger shows Pascal source positions
    ...
Read more

NitroPascal v0.3.0

15 Oct 00:41

Choose a tag to compare

🚀 NitroPascal v0.3.0: Production-Ready Milestone

TL;DR

NitroPascal just crossed the threshold from "interesting experiment" to "actually useful tool". With exception handling, comprehensive string manipulation, file I/O, dynamic arrays, sets, external library integration, and conditional compilation, you can now build real, robust, working applications in pure Delphi syntax that compile to native, high-performance C++.

🎯 The Productivity Milestone

This isn't just another incremental update - v0.3.0 is the milestone where NitroPascal becomes production-ready. You can now:

Handle errors gracefully - try..except..finally for robust error handling
Manipulate strings - Copy, parse, search, format, convert
Read and write files - Text files, binary files, complete file system access
Use dynamic data structures - Dynamic arrays and sets that grow at runtime
Call external libraries - Integrate with any Windows DLL or Unix shared library
Target multiple platforms - Conditional compilation for Windows, Linux, macOS
Build real applications - Not toy programs - actual, productive software

🔥 What's New in v0.3.0

Exception Handling - The Game Changer

This is the big one. Real applications need real error handling. NitroPascal now has full exception support:

function LoadConfig(const AFileName: String): Boolean;
var
  F: TextFile;
  Line: String;
begin
  Result := False;
  try
    Assign(F, AFileName);
    Reset(F);
    try
      while not Eof(F) do
      begin
        ReadLn(F, Line);
        ProcessConfigLine(Line);
      end;
      Result := True;
    finally
      Close(F);  // Always cleanup, even if exception occurs
    end;
  except
    WriteLn('Error loading config: ', GetExceptionMessage());
    Result := False;
  end;
end;

What you get:

  • try..except - Catch and handle errors
  • try..finally - Guaranteed resource cleanup (files, memory, etc.)
  • try..except..finally - Both error handling and cleanup
  • RaiseException(msg) - Throw exceptions
  • GetExceptionMessage() - Retrieve exception message
  • Proper stack unwinding and resource cleanup

This changes everything. You can now write production-quality code that handles errors gracefully, cleans up resources properly, and recovers from failures. No more crossing your fingers and hoping nothing goes wrong.

String Manipulation - Finally Complete

No more cobbling together workarounds - NitroPascal now has a complete string library:

var
  S, SubStr: String;
  Pos: Integer;
begin
  S := 'Hello, World!';
  
  // Extract substrings
  SubStr := Copy(S, 1, 5);  // 'Hello'
  
  // Search strings
  Pos := Pos('World', S);   // 8
  
  // Modify strings
  Delete(S, 8, 6);          // 'Hello, !'
  Insert('Delphi', S, 8);   // 'Hello, Delphi!'
  
  // Transform strings
  S := UpperCase('test');   // 'TEST'
  S := LowerCase('TEST');   // 'test'
  S := Trim('  hello  ');   // 'hello'
  
  // Convert types
  S := IntToStr(42);        // '42'
  Pos := StrToInt('123');   // 123
  S := FloatToStr(3.14);    // '3.14'
  
  // Format output
  S := Format('Value: %d, Percent: %.2f%%', [42, 85.5]);
end.

File I/O - Build Real Applications

Read configuration files. Parse data. Write logs. Generate reports. Do actual work:

procedure ProcessDataFile(const AFileName: String);
var
  F: TextFile;
  Line: String;
  Count: Integer;
begin
  if not FileExists(AFileName) then
    RaiseException('File not found: ' + AFileName);
  
  Count := 0;
  Assign(F, AFileName);
  Reset(F);
  try
    while not Eof(F) do
    begin
      ReadLn(F, Line);
      if ProcessLine(Line) then
        Inc(Count);
    end;
    WriteLn('Processed ', Count, ' lines');
  finally
    Close(F);  // Guaranteed cleanup!
  end;
end;

Dynamic Arrays - Real Data Structures

Static arrays are fine for fixed-size data, but real applications need dynamic structures:

var
  Items: array of Integer;
  Names: array of String;
  I: Integer;
begin
  // Create and resize arrays at runtime
  SetLength(Items, 100);
  for I := 0 to High(Items) do
    Items[I] := I * 2;
  
  // Arrays grow as needed
  SetLength(Names, 10);
  Names[0] := 'Alice';
  Names[1] := 'Bob';
  
  WriteLn('Array has ', Length(Names), ' elements');
end.

Sets - Efficient Membership Testing

Need to track which options are enabled? Which days are selected? Use sets:

type
  TDayOfWeek = (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday);
  TDays = set of TDayOfWeek;
var
  WorkDays: TDays;
begin
  WorkDays := [];
  Include(WorkDays, Monday);
  Include(WorkDays, Tuesday);
  Include(WorkDays, Wednesday);
  Include(WorkDays, Thursday);
  Include(WorkDays, Friday);
  
  if Monday in WorkDays then
    WriteLn('Monday is a work day');
  
  Exclude(WorkDays, Friday);  // Working 4-day week!
end.

External Library Integration - Use Any Library

Call Windows APIs. Use existing C libraries. Integrate with any native code:

// Call Windows MessageBox
function MessageBoxW(hWnd: Integer; lpText, lpCaption: PWideChar; 
  uType: Cardinal): Integer; stdcall; external 'user32.dll';

// Call C standard library
function strlen(str: PAnsiChar): Integer; cdecl; external 'msvcrt.dll';

begin
  // Automatic string conversion at call site
  MessageBoxW(0, 'Hello from NitroPascal!', 'Info', 0);
end.

The compiler automatically tracks external libraries and links them. It converts Pascal string types to C types at the call site. Zero friction interoperability.

Conditional Compilation - One Codebase, All Platforms

Write platform-specific code without breaking other platforms:

program CrossPlatform;

{$ifdef MSWINDOWS}
uses Windows;
{$endif}

{$ifdef POSIX}
uses Unix;
{$endif}

begin
  {$ifdef WIN64}
  WriteLn('Running on 64-bit Windows');
  {$endif}
  
  {$ifdef LINUX}
  WriteLn('Running on Linux');
  {$endif}
  
  {$ifdef DEBUG}
  WriteLn('Debug build');
  {$else}
  WriteLn('Release build');
  {$endif}
end.

Available defines:

  • Platform: WIN32, WIN64, LINUX, MACOS, MSWINDOWS, POSIX
  • Architecture: CPUX64, CPU386, CPUARM64
  • Build mode: DEBUG, RELEASE
  • App type: CONSOLE_APP, GUI_APP

Math Library - Scientific Computing

Trigonometry. Statistics. Numerical analysis. Now possible:

var
  Angle, Result: Double;
  X, Y: Integer;
begin
  // Trigonometry
  Angle := 45.0;
  Result := Sin(Angle);
  Result := Cos(Angle);
  Result := ArcTan(1.0);
  
  // Rounding
  Result := Round(3.7);   // 4
  Result := Trunc(3.7);   // 3
  Result := Ceil(3.2);    // 4
  Result := Floor(3.7);   // 3
  
  // Utilities
  X := Max(10, 20);       // 20
  Y := Min(10, 20);       // 10
  Result := Sqrt(16.0);   // 4.0
  Result := Abs(-42);     // 42
  
  Randomize;
  X := Random(100);       // 0..99
end.

Enhanced Control Flow

Better loop control and function declarations:

var
  I: Integer;
  Found: Boolean;
begin
  // Early exit from loops
  for I := 1 to 100 do
  begin
    if I = 50 then
      break;              // Exit loop
    if I mod 2 = 0 then
      continue;           // Skip to next iteration
    ProcessItem(I);
  end;
  
  // Early return from functions
  function FindValue(A: array of Integer; Target: Integer): Boolean;
  var
    I: Integer;
  begin
    for I := 0 to High(A) do
      if A[I] = Target then
        exit(True);       // Return immediately with value
    Result := False;
  end;
  
  // Forward declarations
  procedure Helper; forward;
  
  procedure Main;
  begin
    Helper();  // Can call before implementation
  end;
  
  procedure Helper;
  begin
    WriteLn('Helper called');
  end;
  
  // Simplified record access
  with MyRecord do
  begin
    Field1 := 10;
    Field2 := 'Hello';
    Method();
  end;
end.

💪 Why This Matters

This release closes the gap between "proof of concept" and "production tool". You now have:

  • 🛡️ Real exception handling - robust error recovery and resource cleanup
  • Real string handling - not just concatenation, actual manipulation
  • 📁 Real file I/O - read configs, parse data, write logs
  • 📊 Real data structures - dynamic arrays and sets that grow at runtime
  • 🔗 Real interoperability - call any external library seamlessly
  • 🌐 Real cross-platform - one codebase, multiple targets
  • 🎯 Real productivity - build actual applications, not toy programs

🎁 The RTL Keeps Getting Better

The Runtime Library now includes:

  • np::String - Complete string manipulation with Delphi semantics
  • np::DynArray - Dynamic arrays that grow and shrink
  • np::Set - Efficient set operations and membership testing
  • File I/O wrappers - Maintain Delphi file handling semantics in C++
  • Math functions - Comprehensive mathematical operations
  • String conversions - Seamless type conversions
  • Exception support - Full try..except..finally implementation

Everything maintains true Delphi semantics while generating optimal C++ code that compiles to native machine code via Zig's LLVM backend.

📚 Documentation

Want to see what's working RIGHT NOW?

  • COVERAGE.md - Complete feature checklist showing all implemented features
  • DESIGN.md - Deep dive into the RTL wrapping architecture
  • MANUAL.md - User guide and getting started
    ...
Read more

NitroPascal v0.2.0

13 Oct 00:13

Choose a tag to compare

🎯 NitroPascal v0.2.0: The RTL Wrapping Breakthrough

TL;DR

NitroPascal can now compile Delphi syntax directly to high-performance C++ through our innovative Runtime Library (RTL) wrapping strategy. Write pure Delphi, get native C++ performance.

💡 The Breakthrough: RTL Wrapping Architecture

Instead of complex code generation that attempts to map Delphi semantics to C++, we've taken a revolutionary approach: wrap every Delphi construct in a C++ runtime library (under the np:: namespace).

What this means:

  • Delphi's for loopsnp::ForLoop() - handles inclusive ranges perfectly
  • Delphi's div/modnp::Div()/np::Mod() - exact Delphi semantics
  • Delphi's Stringnp::String - UTF-16 with 1-based indexing, just like Delphi
  • Delphi's WriteLnnp::WriteLn() - variadic templates, handles any types

The result? The code generator is now trivial - just simple syntax translation. All complexity lives in the RTL, which is written once, tested once, and reused forever.

🎉 What's New in v0.2.0

This release establishes the foundation with comprehensive Delphi language support:

Type System

  • Complete scalar types: Integer, Boolean, Char, Double, Single, Byte, Word, Cardinal, Int64
  • Complex types: String (UTF-16), Pointer, Record, Array (static & dynamic), Set, Enum
  • Full pointer semantics with New/Dispose

Operators & Expressions

  • Arithmetic: +, -, *, /, div, mod
  • Comparison: =, <>, <, >, <=, >=
  • Logical: and, or, xor, not
  • Bitwise: shl, shr, and, or, xor
  • Set operations: in, +, -, *

Control Flow

  • Conditional: if..then..else, case..of
  • Loops: for..to..do, for..downto..do, while..do, repeat..until
  • All with proper Delphi semantics (inclusive ranges, evaluated-once bounds, etc.)

Functions & Procedures

  • Full function/procedure declarations
  • Parameter modes: const, var, out
  • Result variable handling
  • Forward declarations

I/O & System Functions

  • Console I/O: Write, WriteLn, Read, ReadLn
  • Memory management: New, Dispose, GetMem, FreeMem
  • String functions: Length, Copy, Pos, IntToStr, StrToInt

🔥 Why This Architecture Matters

By wrapping Delphi semantics in C++, we achieve:

  • True Delphi compatibility - not approximations or "close enough"
  • C-level performance - via Zig's LLVM optimization pipeline
  • 🌐 Cross-platform everywhere - Windows, Linux, macOS, embedded, WebAssembly
  • 🎯 Simple, maintainable compiler - complexity lives in RTL, not in code generation
  • 🔧 Debuggable output - generated C++ is readable and understandable

Write pure Delphi → Get native C++ performance. No compromises.

📚 Documentation

Want to see what's working RIGHT NOW?

  • COVERAGE.md - Complete feature checklist: [x] implemented vs [ ] planned
  • DESIGN.md - Deep dive into the RTL wrapping architecture
  • MANUAL.md - User guide and getting started

Check the docs to see exactly what Delphi syntax you can use today!

🚀 Getting Started

# Clone the repository
git clone https://github.com/tinyBigGAMES/NitroPascal
cd NitroPascal

# Compile your first Delphi program
nitropascal hello.pas

Example Delphi program:

program Hello;
var
  i: Integer;
begin
  for i := 1 to 10 do
    WriteLn('Hello from NitroPascal! Count: ', i);
end.

Compiles to optimized native code via C++ → LLVM → machine code.

🌐 Community

🔮 What's Next?

Each update expands the RTL with more Delphi semantics!

What Delphi features do YOU want to see in the next release? Let us know in the discussions!


The future of Pascal is here, and it's wrapped in a beautiful C++ runtime library. 🎁


File Integrity

Files are signed with minisign using this public key:
RWTqBYfsUOCQscb6ZeknLC0On3cvWCVzMzlHamtgXNaDOO4bNs3WCSkV

NitroPascal v0.1.0

07 Oct 20:19

Choose a tag to compare

NitroPascal v0.1.0 - First Public Release

Overview

Complete implementation of a modern Pascal-to-C++ transpiler with comprehensive
language support and 376 passing tests across all major language features.

Core Architecture

Lexer (NitroPascal.Lexer.pas)

  • Full tokenization of Pascal source code
  • Support for all literals: integer, float, string, char, boolean
  • All operators: arithmetic, comparison, logical, bitwise
  • Comment handling: line (//) and block (* *) comments
  • Preprocessor directives: #define, #ifdef, #ifndef, #else, #endif
  • Compiler directives: $optimize, $target, $exceptions, etc.

Parser (NitroPascal.Parser.pas)

  • Complete AST generation for all language constructs
  • Program, Module, and Library compilation units
  • Full expression parsing with proper precedence
  • All statement types (if, while, for, repeat, case, etc.)
  • Conditional compilation with symbol tracking
  • Error recovery and detailed error reporting

Code Generator (NitroPascal.CodeGen.pas)

  • Transpilation to modern, idiomatic C++ code
  • Smart type mapping (string → std::string, arrays → std::array)
  • Support for all parameter passing modes (value, const, var, out)
  • Visibility control (public/private for modules)
  • Header (.h) and implementation (.cpp) file generation

Language Features

Type System (Complete)

✅ Primitive types: int, uint, int64, uint64, int16, uint16, byte, double,
float, bool, char, string, pointer
✅ Arrays: Fixed-size, multi-dimensional (1D, 2D, 3D+)
✅ Records: Structs with field access, nested records
✅ Pointers: Declaration, dereferencing, arithmetic, function pointers
✅ Enumerations: Integer-based enums
✅ Subrange types: Type aliases with range documentation
✅ Function types: Function pointer type declarations
✅ Type aliases: Custom type definitions

Control Flow (Complete)

✅ if/then/else statements
✅ while loops
✅ for/to and for/downto loops
✅ repeat/until loops
✅ case statements with multiple values and ranges
✅ break and continue
✅ Nested control structures

Routines (Complete)

✅ Procedures and functions
✅ Parameter modes: value, const, var, out
✅ Variadic parameters (...)
✅ Local variables and nested scopes
✅ Return values
✅ Function overloading preparation

Operators (Complete)

✅ Arithmetic: +, -, *, /, div, mod
✅ Comparison: =, <>, <, >, <=, >=
✅ Logical: and, or, not, xor
✅ Bitwise: and, or, xor, not, shl, shr
✅ Pointer: ^, @
✅ String concatenation: +

External Interop (Complete)

✅ C header imports: extern <header.h>
✅ DLL imports: extern dll "name.dll" [stdcall|cdecl|fastcall]
✅ Variadic function support
✅ Type mapping for C interop

Preprocessor (Complete)

✅ Conditional compilation: #ifdef, #ifndef, #else, #endif
✅ Symbol definition: #define, #undef
✅ Nested conditionals
✅ Parser-integrated (zero runtime overhead)

Compiler Directives (Complete)

✅ $optimize: debug, release_safe, release_small, release_fast
✅ $target: Platform targeting (x86_64-windows, etc.)
✅ $exceptions: Enable/disable C++ exceptions
✅ $strip_symbols: Symbol table stripping
✅ $module_path, $include_path, $library_path
✅ $link_library: Link external libraries

Build System

✅ Zig build system integration
✅ Multi-platform support (Windows, Linux, macOS)
✅ Automatic build.zig generation
✅ C++ standard library linking

Test Coverage

376 tests - All passing across:

  • Lexer Tests (10): Tokenization and scanning
  • Parser Tests (12): AST construction
  • CodeGen Tests (14): Basic code generation
  • String Tests (36): String operations, methods, parameters
  • Number Tests (51): Integer/float arithmetic, bitwise, precedence
  • Array Tests (36): Indexing, multi-dim, parameters
  • Record Tests (36): Fields, nesting, operations
  • Pointer Tests (43): Address-of, dereference, arithmetic
  • Control Flow Tests (34): All loop types, case statements
  • Type Tests (40): Type system features
  • Parameter Tests (44): All parameter modes
  • Conditional Compilation Tests (20): Preprocessor directives

Project Structure

NitroPascal/
├── src/
│   ├── NitroPascal.Types.pas       # AST node definitions
│   ├── NitroPascal.Lexer.pas       # Lexical analysis
│   ├── NitroPascal.Parser.pas      # Syntax analysis & AST
│   ├── NitroPascal.CodeGen.pas     # C++ code generation
│   ├── NitroPascal.Compiler.pas    # Main compiler orchestration
│   ├── NitroPascal.Symbols.pas     # Symbol table management
│   ├── NitroPascal.Resolver.pas    # Name resolution
│   └── NitroPascal.Utils.pas       # Utilities
├── examples/
│   └── testbed/                    # 376-test suite
├── docs/
│   └── MANUAL.md                   # Complete language reference
└── bin/                            # Compiled executables

Documentation

  • Complete language manual (MANUAL.md)
  • 376 example test cases
  • API documentation in source
  • README with quick start guide

Known Limitations

  • No dynamic arrays (fixed-size only)
  • No classes with inheritance (records only)
  • No generics
  • No interfaces
  • No inline assembly

File Integrity

Files are signed with minisign using this public key:
RWTqBYfsUOCQscb6ZeknLC0On3cvWCVzMzlHamtgXNaDOO4bNs3WCSkV