Skip to content

CPaskal v0.1.0

Latest

Choose a tag to compare

@jarroddavis68 jarroddavis68 released this 29 Aug 08:16
· 3 commits to main since this release

CPaskal -- Pascal Elegance. C Interop. Native Binaries.

CPaskal is a systems programming language that combines Pascal's clarity with complete C ABI interoperability. It compiles .cpas source files to C++23, then builds native x86_64 binaries via a bundled Zig/Clang toolchain. No external compiler, no build-system glue, no configuration -- point CPaskal at a .cpas file and it produces an executable.

This is the first public release.

Highlights

  • Pascal-flavored systems language -- clean begin..end blocks, := assignment, strong static typing, and a module system. Keywords are case-insensitive; identifiers are case-sensitive.
  • Full C ABI interop -- consume any C library via external clause with name aliasing. Produce C-compatible DLLs and static libraries that Python, Rust, Go, C#, and any other language can call.
  • Four module kinds -- module exe (executable), module dll (shared library), module lib (static library), module unit (importable source module). All support initialize/finalize lifecycle hooks.
  • Rich type system -- 16 explicit-width primitive types (int8..int64, uint8..uint64, float32, float64, boolean, char, wchar, string, wstring, pointer), records with single inheritance, overlays (unions), packed/aligned records, bit fields, choices (enums), sets with algebra, dynamic arrays, routine types.
  • Structured exceptions -- guard/except/finally catches both software exceptions (throw/throwcode) and hardware faults (divide-by-zero, access violations).
  • C++ escape hatch -- cppstart/cppend blocks inject raw C++ into generated output. cpp() inline expressions for seamless interop. The boundary between CPaskal and C++ is paper-thin.
  • Conditional compilation -- @ifdef/@ifndef/@else/@elseif/@endif with predefined platform symbols (CPASKAL, TARGET_WIN64, TARGET_LINUX64, DEBUG, RELEASE, BUILD_EXE, BUILD_DLL, BUILD_LIB).
  • CImporter -- auto-generates .cpas binding modules from C header files via .cis scripts. Production bindings for raylib, SDL3, SDL3_mixer, and SDL3_image ship with the release.
  • Built-in unit testing -- test blocks with assertion intrinsics (asserteq, asserttrue, assertfalse, asserteqf, assertnil, assertnotnil, assertfail).
  • Format-string output -- println("value = {}", x) with C++23 std::format syntax.

Tooling

  • cpas.exe -- the command-line compiler. -r build-and-run, -d debug, -t target, -opt optimization level, -h help.
  • Native debugger -- a DAP-based source-level debugger for Windows executables. Supports breakpoints, step in/over/out, variable inspection, and call stack navigation. Launch with cpas myapp -d.
  • @breakpoint directive -- mark debugger breakpoint locations in source with zero runtime overhead.

Quick start

cpas hello -r

Compiles hello.cpas to a native executable via the bundled toolchain and runs it.

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

Path Description
bin/cpas.exe CLI compiler
bin/res/runtime/ CPaskal C++ runtime
bin/res/libs/std/ Standard library modules
bin/res/libs/vendor/ Vendor bindings (raylib, SDL3, SDL3_mixer, SDL3_image)
bin/res/tests/ Test suite (.cpas sources)
bin/res/zig/ Bundled Zig/Clang toolchain
docs/CPaskal.md Reference manual (Markdown)
docs/CPaskal.pdf Reference manual (PDF)
media/ Logo and branding
README.md Project overview
LICENSE License

Documentation: See docs/CPaskal.md (or docs/CPaskal.pdf) for the complete language reference. Online at cpaskal.org.

Requirements: Windows 10/11 x64. Linux targets build via WSL2 + Ubuntu. Building the compiler from source requires Delphi 12 Athens.

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.