Skip to content

Releases: tinyBigGAMES/PaskalCPP

Release list

PaskalCPP v0.1.0

Choose a tag to compare

@jarroddavis68 jarroddavis68 released this 16 Oct 17:44

PaskalCPP -- Write Pascal-style code, use any C and C++ library.

PaskalCPP is a minimal, Pascal and Oberon inspired systems programming language that compiles to C++23 and mixes freely with C++ in the same source file, so every C and C++ library is available with no bindings. The compiler writes a C++23 header and source for each module and builds them with the bundled Zig toolchain (clang): one pcpp command turns a .pcpp file into a native binary.

This is the first public release.

Highlights

  • Readable by design -- Pascal and Oberon blocks, := for assignment and = for equality, ; after every statement, each construct closed by its own end, names declared before they are used.
  • C++ is the surface -- #include a header and call it: no import, binding or wrapper layer. A C++ type (std::string, std::vector<int>) can be the type of a PaskalCPP variable, and C++ declarations (a struct, a function, a template) stand at module level. cpp header; / cpp source;, cppstart ... cppend; and cpp("...") cover the corner cases.
  • Four module kinds -- module exe, module dll, module lib and module unit (imported by other modules); every kind may have initialize and finalize sections.
  • Types and objects -- explicit-width integers and floats, records (with extensions, packed, aligned, bitfields), overlays, choices, sets, static and dynamic arrays, pointers and routine types; objects with init / done, virtual / override, interfaces, embeds, properties and declared operators, held on the heap by own, ref and weak owners.
  • No hidden conversions -- a value converts implicitly only when it fits the target exactly, in arithmetic too; constant expressions are folded and checked (an overflow, a zero divisor, a shift count out of range is an error, never a silent wrap).
  • Structured exceptions -- guard / except / finally catches raise / raisecode, hardware faults (an access through nil, an integer division by zero, a stack overflow) and C++ exceptions thrown by mixed C++ or a C++ library. A nil access is caught at every optimize level, release builds included.
  • Errors speak PaskalCPP -- a mistake on a PaskalCPP construct is reported in PaskalCPP's words and types; what only C++ can judge is clang's or the linker's own message, mapped back to the .pcpp file, line and column.
  • Conditional compilation -- @define / @undef / @ifdef / @ifndef / @elseif / @else / @endif, with predefined symbols per file: PASKALCPP, BUILD_EXE / BUILD_DLL / BUILD_LIB / BUILD_UNIT, TARGET_WINDOWS, TARGET_LINUX, TARGET_X86_64, TARGET_64BIT and the whole target triple.
  • Built-in unit testing -- test "name" blocks after the module's end., run in test mode, with twelve asserts (testAssert, testAssertTrue, testAssertFalse, testAssertNil, testAssertNotNil, testFail, testAssertEqualInt, testAssertEqualUInt, testAssertEqualFloat, testAssertEqualStr, testAssertEqualBool, testAssertEqualPtr).
  • Format-string output -- println("value = {}", x) with C++23 std::format; every argument prints by its PaskalCPP type.
  • Two targets, one source -- @target or pcpp -t picks x86_64-windows-gnu or x86_64-linux-gnu; pcpp <file> -r runs a Linux build through WSL.

Tooling

  • pcpp.exe -- the compiler. -r build and run, -d debug, -t target, -opt optimize level (debug, release_safe, release_fast, release_small), -o output folder, -h help; -- passes the rest of the command line to the program.
  • The PaskalCPP Editor (pcpp editor [files]) -- an Electron application whose editing surface is Monaco, with build, run and debug.
  • A language server (pcpp --lsp) -- the Language Server Protocol server the editor runs, and any LSP client can.
  • A debugger for the x86_64-windows-gnu target -- the console debugger (pcpp <file> -d) and the debug adapter (pcpp --dap) the editor runs, both on one engine. Every @breakpoint statement in the source is a breakpoint.
  • testbed.exe -- the compiler's own test runner (testbed.exe -all, testbed.exe -h).
  • warmup.cmd -- fills zig's cache for every target and optimize level, so a first build does not wait for zig to compile libc and libc++.

Quick start

Build and run a program:

pcpp hello.pcpp -r

Compiles hello.pcpp to a native executable with the bundled toolchain and runs it.

Start the editor:

pcpp editor

Opens the PaskalCPP Editor. Name files to open them in it (pcpp editor hello.pcpp), or start it directly with bin\res\editor\editor.exe.

Release contents (PaskalCPP-0.1.0-x86_64-windows.zip)

The zip unzips at the repository root: unzipped into a clone of the repo, every file lands where the repo's own layout puts it.

Path Description
bin/pcpp.exe Compiler, editor launcher, language server and debugger
bin/testbed.exe The compiler's test runner
bin/warmup.cmd Warms zig's cache for every target and optimize level
bin/res/runtime/ PaskalCPP C++ runtime
bin/res/libs/std/ Standard library modules
bin/res/libs/vendor/ Vendor libraries (raylib, SDL3, SFML)
bin/res/editor/ The PaskalCPP Editor
bin/res/tests/ Compliance test suite (.pcpp sources)
bin/res/examples/ Examples
bin/res/zig/ Bundled Zig/Clang toolchain, with its warmed cache
docs/html/ Documentation (offline HTML)
media/ Logo and branding
README.md Project overview
LICENSE, NOTICE.md, RUNTIME-EXCEPTION.md, TRADEMARK.md License (MPL-2.0), notices, runtime exception, trademark
CONTRIBUTING.md, CODE_OF_CONDUCT.md How to contribute, code of conduct

Documentation: open docs/html/index.html for the full documentation offline, or read it online at paskalcpp.org/docs; start with the tour.

License: free and open source under the Mozilla Public License 2.0. The runtime and standard library files PaskalCPP builds into your programs carry an additional permission: see RUNTIME-EXCEPTION.md.

Requirements: Windows x64. Linux targets run through WSL. Building the compiler from source requires Delphi (RAD Studio) and this release unzipped into the repo folder.

File Integrity

Release files are signed with minisign to verify their authenticity and integrity.

Public key:
RWSLGfwSOWByrazkUwTzwlJ3rozKvaSnr3KT2aS/hSPDSLzUTPgj/m2X

To verify a downloaded file:

minisign -Vm <filename> -P RWSLGfwSOWByrazkUwTzwlJ3rozKvaSnr3KT2aS/hSPDSLzUTPgj/m2X

A successful verification confirms that the file was signed by the project and has not been modified since it was signed.