Skip to content

PaskalCPP v0.3.0

Latest

Choose a tag to compare

@jarroddavis68 jarroddavis68 released this 31 Oct 18:09
· 1 commit to main since this release

PaskalCPP 0.3.0 -- Projects, and a fuller box

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 release is about building something bigger than one file. Projects give a program its own folder, its own output and its assets packed into one password-protected file, with the editor and the command line working the same way. Fourteen more libraries join the box, among them language models through llama.cpp, a JIT compiler, a user interface toolkit, SQLite and Lua, each with standard library units that load straight from a zip. Fifty-nine examples, up from twenty-nine, show it all on Windows and Linux.

Highlights

  • Projects -- pcpp init MyProject exe makes a project folder: project.toml, src\MyProject.pcpp, assets\ and pack.cmd. pcpp build MyProject -r builds it into its own output folder, and pcpp pack MyProject zips assets\ into MyProject.dat beside the program. A single file still needs no project file: nothing changes for a build with no project.toml.
  • Assets with no password in the source -- pcpp init generates a random pack password into project.toml. In a project build ProjectPassword() returns it at run time, handed to the program scrambled so the password is never plain text in the exe: CreateZipFileIO("$P:MyProject.dat", "sprites/ship.png", ProjectPassword()).
  • Projects in the editor -- a folder with a valid project.toml opens as a project: its root badged in the explorer, Build / Run / Debug go through pcpp build, File > New Project... makes one, and Build > Pack (Ctrl+Alt+B) packs it.
  • Language models -- import llama_ext; runs a GGUF model with llama.cpp b11971 in a few lines, on any vendor's GPU through Vulkan or on the CPU: chats with the model's own template, text streamed as it is written, sampling options and stop strings, output held to a grammar or a JSON schema, embeddings, and a model loaded from a zip entry.
  • Fourteen more libraries -- SQLite 3.54.1, Lua 5.5.1, Zstandard 1.5.7, pugixml 1.16, yyjson 0.13.0, ENet 1.3.18, flecs 4.1.6, tmxlite 1.4.5, LDtkLoader 1.5.3.1, mojoAL, Raven 0.1.3, MIR 1.0.0, llama.cpp b11971 and raylib's rlgl, each one import away on both targets.
  • A JIT compiler -- MIR 1.0.0 with its c2mir C frontend, and mir_ext to use it with no C++ in the program: MIR text, C compiled at run time, the binary form from a string, a file or a zip, functions built in code, linking and calls.
  • User interfaces in raylib -- Raven's widgets, layout, themes and XML-described windows inside a raylib program through raven_raylib, with raylib textures shown in Raven widgets.
  • The frame window -- raylib_ext opens a raylib window at a virtual resolution sized for the monitor's DPI and letterboxed on resize, with pixel-perfect integer scaling and a window zoom; rlimgui_ext runs Dear ImGui inside it.
  • More of the box reads from a zip -- mojoal_ext (sounds), sqlite_ext (a database), tmxlite_ext (Tiled maps) and ldtk_ext (LDtk projects) load from a path, any IO source or a zip entry.

New

  • StrUtils -- Trim, TrimLeft, TrimRight, SplitString, TryStrToInt and StrToIntDef, with Delphi's names and rules.
  • Diagnostics -- a Stopwatch with Delphi's TStopwatch names on a monotonic clock.
  • SysUtils files and folders -- FileSize, RenameFile, ForceDirectories, ReadAllText, WriteAllText, ExtractFileName, ChangeFileExt, TempDir and Halt.
  • CustomIO writes zips -- ZipDirectoryContents zips a folder (with a password when given), GetZipEntryInfo reads an entry's size and CRC-32, and IOCopy copies one stream into another.
  • Console.ReadLn reads a line of input; Math gains CosineSimilarity.
  • $R: names the project root in a project build's paths (@addmodulepath "$R:units";).
  • pcpp --project-info <folder> prints a project as one JSON line, for editors and tools.
  • The test runner is back -- testbed.exe ships again, now that the test suite is self-contained: it builds and runs every .pcpp test on both targets at every optimize level and checks the result, so you can change the language, add tests beside the official ones and run the whole suite.

Changed

  • The compliance test suite (bin/res/tests) is organized into one folder per area (decl\, expr\, std\, ...), each test run on both targets at all four optimize levels.

Fixed

  • A clang error with no location in a file added by @addsourcefile is now reported at the @addsourcefile line that added the file.

Tooling

  • pcpp.exe -- the compiler. -r build and run, -d debug, -t target, -opt optimize level (debug, safe, fast, small), -o output folder, --clean clear an output folder, -h help; -- passes the rest of the command line to the program. Projects: pcpp init <name> <exe|dll|lib>, pcpp build [<folder>], pcpp pack [<folder>].
  • The PaskalCPP Editor (pcpp editor [files]) -- an Electron application whose editing surface is Monaco, with build, run, debug and projects; File > Show Examples opens the bundled examples.
  • A language server (pcpp --lsp) -- the Language Server Protocol server the editor runs, and any LSP client can.
  • testbed.exe -- the test runner, run from the bin folder: testbed -all (every test in every target and optimize level), a test id or a glob (testbed "type.*"), -t / -opt to pick cells, -failed for the last run's failures, -list to list the tests, -h help.
  • 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.

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.

Start a project:

pcpp init MyProject exe
pcpp build MyProject -r

Makes the project folder MyProject, then builds it into its own output folder and runs it. Put files in MyProject\assets and pcpp pack MyProject zips them into MyProject.dat for the program to read.

Release contents (PaskalCPP-0.3.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 Test runner for the compliance test suite
bin/assets.zip The examples' shared assets, packed
bin/res/runtime/ PaskalCPP C++ runtime
bin/res/libs/std/ Standard library and vendor units
bin/res/libs/vendor/ Vendor libraries, static, for both targets
bin/res/editor/ The PaskalCPP Editor
bin/res/tools/ The asset packer pcpp pack builds
bin/res/tests/ Compliance test suite (.pcpp sources)
bin/res/examples/ Examples
bin/res/assets/ The examples' shared assets
bin/res/zig/ Bundled Zig/Clang toolchain (zig 0.17.0)
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, then Projects, the Standard library and Vendor libraries.

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. A language model runs on the GPU when a Vulkan driver is installed, else on the CPU. 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.