Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

Commit 668a1ab

Browse files
committed
Repo Update
Release v0.2.0: Core language features and RTL foundation This release establishes the foundational architecture and implements core Object Pascal language features with the RTL wrapping strategy. LANGUAGE FEATURES: - Complete basic type system (Integer, Double, String, Boolean, Pointer, etc.) - Type aliases and pointer type declarations - Constants (typed and untyped) and variables (local/global) - All arithmetic, comparison, logical, and bitwise operators - Control flow: if/else, case, for, while, repeat-until - Functions and procedures with multiple parameter passing modes - Static arrays, records, enumerations, and pointers - Memory management (New/Dispose) RUNTIME LIBRARY (RTL): - I/O functions (Write/WriteLn with variadic templates) - Control flow wrappers (ForLoop, WhileLoop, RepeatUntil) - Operator functions (Div, Mod, Shl, Shr) - String class (np::String with UTF-16 and 1-based indexing) - All Delphi semantics wrapped in np:: namespace CODE GENERATION: - Header (.h) and implementation (.cpp) file generation - Namespace per unit - RTL wrapping strategy: complexity in RTL, not codegen - Forward declarations and proper includes BUILD SYSTEM: - Zig build integration for cross-platform compilation - Multiple optimization modes (Debug, ReleaseSafe, ReleaseFast, ReleaseSmall) - Program → executable, Library → .dll/.so/.dylib, Unit → .lib/.a - Compiler directives support ({$optimization}, {$target}, etc.) TOOLS: - nitro CLI with build, run, clean, init, version, help commands PLATFORMS: - Windows x64, Linux x64, macOS x64 DOCUMENTATION: - Updated README.md with documentation links (COVERAGE.md, DESIGN.md, MANUAL.md) - Updated code examples to demonstrate RTL wrapping approach - Added DelphiAST attribution - Complete language coverage tracking (COVERAGE.md) - Comprehensive design document (DESIGN.md) ARCHITECTURE: The core architectural principle is RTL wrapping: all Delphi constructs are wrapped in C++ runtime library functions. This makes the code generator a simple syntax translator while ensuring correct Delphi semantics. The transpilation pipeline is: Pascal → C++ (via RTL) → Native Code (via Zig/LLVM). Version: 0.2.0
1 parent afadb3d commit 668a1ab

File tree

94 files changed

+26638
-19705
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+26638
-19705
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,9 @@ bin/run_unittests.cmd
9292
bin/results.txt
9393
_distro.cmd
9494
pack.yml
95+
bin/result.txt
96+
bin/test.json
97+
bin/test_small.json
98+
src/TASK.md
99+
src/TASK0.md
100+
src/TASK2.md

README.md

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -121,28 +121,25 @@ end.
121121
<td>
122122

123123
```cpp
124-
// Optimized C++ output
125-
#include <iostream>
124+
// Generated C++ with NitroPascal RTL
125+
#include "nitropascal_rtl.h"
126126

127127
struct TPoint {
128-
int32_t X;
129-
int32_t Y;
128+
int32_t X;
129+
int32_t Y;
130130
};
131131

132132
void PrintPoint(const TPoint& P) {
133-
std::wcout << L"Point(" << P.X
134-
<< L", " << P.Y << L")"
135-
<< std::endl;
133+
np::WriteLn("Point(", P.X, ", ", P.Y, ")");
136134
}
137135

138136
int main() {
139-
TPoint Point;
140-
Point.X = 10;
141-
Point.Y = 20;
142-
PrintPoint(Point);
143-
std::wcout << L"Hello from NitroPascal!"
144-
<< std::endl;
145-
return 0;
137+
TPoint Point;
138+
Point.X = 10;
139+
Point.Y = 20;
140+
PrintPoint(Point);
141+
np::WriteLn("Hello from NitroPascal!");
142+
return 0;
146143
}
147144
```
148145
@@ -189,10 +186,12 @@ Download the latest release from the [Releases page](https://github.com/tinyBigG
189186
190187
## 📚 Documentation
191188
189+
- **[Language Coverage](docs\COVERAGE.md)** - Supported Object Pascal features and implementation status
190+
- **[Design Document](docs\DESIGN.md)** - Complete architecture and implementation guide
191+
- **[User Manual](docs\MANUAL.md)** - Comprehensive guide for using NitroPascal
192192
- **[Third-Party Libraries](THIRD-PARTY.md)** - Open source libraries used by NitroPascal
193193
- **[Website](https://nitropascal.org)** - Official NitroPascal website
194-
- **API Reference** *(coming soon)*
195-
- **Language Guide** *(coming soon)*
194+
196195
197196
## 🤝 Contributing
198197
@@ -203,8 +202,6 @@ We welcome contributions! NitroPascal is in active development and there are man
203202
- 📖 Improve documentation
204203
- 🔧 Submit pull requests
205204
206-
Please check our [Contributing Guidelines](CONTRIBUTING.md) *(coming soon)* for more details.
207-
208205
## 📄 License
209206
210207
NitroPascal is licensed under the [BSD-3-Clause License](https://github.com/tinyBigGAMES/NitroPascal?tab=BSD-3-Clause-1-ov-file#BSD-3-Clause-1-ov-file).
@@ -225,6 +222,7 @@ This means you can use NitroPascal to build both open-source and proprietary app
225222
226223
NitroPascal builds upon excellent open-source projects:
227224
225+
- **[DelphiAST](https://github.com/RomanYankovsky/DelphiAST)** - Object Pascal parser
228226
- **[LLVM](https://github.com/llvm/llvm-project)** - Compiler infrastructure
229227
- **[Zig](https://github.com/ziglang/zig)** - Programming language and toolchain
230228

THIRD-PARTY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ NitroPascal is built on the shoulders of these excellent open-source projects. W
66

77
| Library | Description | Repository |
88
|---------|-------------|------------|
9+
| **DelphiAST** | Abstract Syntax Tree builder for Delphi - provides robust Pascal parsing capabilities | [GitHub](https://github.com/RomanYankovsky/DelphiAST) |
910
| **LLVM** | The LLVM Compiler Infrastructure - modular and reusable compiler and toolchain technologies | [GitHub](https://github.com/llvm/llvm-project) |
1011
| **Zig** | A general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software | [GitHub](https://github.com/ziglang/zig) |
1112

config/postprocess_default.json

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"version": "1.0",
3+
"description": "Default post-processing rules for NitroPascal C header conversion",
4+
5+
"opaquePointerTypes": [
6+
{
7+
"pattern": "PFILE",
8+
"baseName": "FILE_t",
9+
"pointerName": "PFILE_t",
10+
"baseType": "Pointer",
11+
"comment": "C FILE handle from stdio.h"
12+
},
13+
{
14+
"pattern": "Pva_list",
15+
"baseName": "va_list_t",
16+
"pointerName": "Pva_list_t",
17+
"baseType": "Pointer",
18+
"comment": "C va_list from stdarg.h"
19+
}
20+
],
21+
22+
"typeReplacements": [
23+
],
24+
25+
"identifierReplacements": [
26+
{
27+
"find": "_file",
28+
"replace": "AFile",
29+
"scope": "parameters",
30+
"comment": "Avoid underscore prefix in parameter names"
31+
},
32+
{
33+
"find": "_type",
34+
"replace": "AType",
35+
"scope": "parameters",
36+
"comment": "Avoid underscore prefix in parameter names"
37+
},
38+
{
39+
"find": "_end",
40+
"replace": "AEnd",
41+
"scope": "fields",
42+
"comment": "Avoid underscore prefix in field names"
43+
},
44+
{
45+
"find": "_string",
46+
"replace": "AString",
47+
"scope": "fields",
48+
"comment": "Avoid underscore prefix in field names"
49+
}
50+
],
51+
52+
"keywordEscapes": [
53+
{
54+
"keyword": "type",
55+
"replacement": "AType"
56+
},
57+
{
58+
"keyword": "file",
59+
"replacement": "AFile"
60+
},
61+
{
62+
"keyword": "name",
63+
"replacement": "AName"
64+
},
65+
{
66+
"keyword": "label",
67+
"replacement": "ALabel"
68+
},
69+
{
70+
"keyword": "packed",
71+
"replacement": "APacked"
72+
}
73+
]
74+
}

0 commit comments

Comments
 (0)