Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

NitroPascal v0.2.0 #4

Discussion options

🎯 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! Upcoming features:

  • Classes and objects (OOP support)
  • Generics (TList<T>, TDictionary<K,V>)
  • Exception handling (try..except..finally)
  • Unit system and separate compilation
  • Standard library (System, SysUtils, Classes)

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. 🎁


Full Changelog: v0.1.0...v0.2.0

File Integrity

Files are signed with minisign using this public key:
RWTqBYfsUOCQscb6ZeknLC0On3cvWCVzMzlHamtgXNaDOO4bNs3WCSkV


This discussion was created from the release NitroPascal v0.2.0.
You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /