graemeg/blaise: A modern, self-hosting Object Pascal compiler built for the 2020s. Zero legacy, full ARC, and unified UTF-8. · GitHub

Repository files navigation

The Pascal you love, reimagined for the modern age.

Blaze is a next-generation Object Pascal compiler built from the ground up to eliminate decades of legacy burden. It prioritizes developer productivity, memory protection, and high-performance execution.

There are two options in the Object Pascal ecosystem: Embarcadero Delphi (proprietary, Windows-first) and Free Pascal (open source but with 30 years of accumulated complexity – five language modes, five string types and thousands of included files).

This compiler takes a different approach:

  • A language genre. No {$mode} switch; No legacy dialect support.

  • A string type. UTF-8 reference-math string. RawBytes For binary data.

  • A memory model. Automatic reference counting applies to strings, classes, and interfaces alike. No manual/auto split in between TObject
    And TInterfacedObject; [Weak] Breaks the cycle. Free Kept as a synonym for immediate release.

  • Clean interface. No COM guide; Interface dispatch via compile-time vetable mapping.

  • Refined generic. Monomorphization at compile time – no degradation.

  • Modern manufacturing system. with passbuild project.xml; No makefile.

  • First class debugger. OPDF is the default debug format; There is no need for dwarfism.

The result – a modern, cross-platform Object Pascal compiler targeting native code via QBE (and eventually LLVM). Single language mode, single string type, zero-GUID interface, modified generics, and first-class OPDF debug format support.

  • Self-Hosting: Yes. Blaze currently bootstraps and recompiles itself with byte-by-byte exact matches.

  • tests: 1200+ testing and development (test-driven development from day one).

  • Backend: The QBE backend is currently being used with an LLVM backend in active development.

phase Target Situation

1

Bootstrap Pipeline – Hello World on Linux x86_64 via passbuild

Complete ✅

2

Type System – Class, Record, ARC, Exception

Complete ✅

3

generic + zero-guid interface

Complete ✅

4

OPDF debug information emission

Complete ✅

5

Self-Hosting + LLVM + Windows + MacOS ARM64

is in progress

6

LSP + VS Code Extension

planned to

7

Migration analyzer for FPC/Delphi codebases

planned to

What has been removed from Classic Pascal?

Speciality Reason for Removal

ShortString, AnsiString, WideString, UnicodeString

Replaced by single UTF-8 reference-counting string Type

with statement

Source of hard-to-diagnose symbol resolution bugs; breaks static analysis

old style object Type

Use record (stack/value) or class (stack/reference) instead

COM-style interface GUID

interface dispatch via compile-time vtable; GUIDs are unnecessary complexity

Multiple Language Mode

One bid, well maintained, beats five bad bids

assign, reset, rewrite, blockread

Stream-based I/O replaced by RTL

TObject versus TInterfacedObject split

A unified class model under automatic reference counting; [Weak]
breaks the cycle

The core architecture is still being finalized, so the project is not accepting code contributions yet. Feedback on language design, syntax choices, and the future direction of Blaze is most welcome – please use the discussion tab on GitHub.

This project uses PasBuild’s multi-module layout. with each subdirectory a
project.xml is an independent module; Root project.xml Is an aggregator.

project.xml                       Root aggregator (packaging=pom)
│
├── compiler/                     The compiler binary (packaging=application)
│   ├── project.xml
│   └── src/
│       ├── main/pascal/          uLexer, uParser, uAST, uCodeGenQBE, ...
│       └── test/pascal/          FPTest test suite for compiler units
│
├── rtl/                          Runtime library (packaging=library)
│   ├── project.xml
│   └── src/
│       ├── main/pascal/          System.pas, SysUtils.pas, Classes.pas, ...
│       └── test/pascal/          FPTest test suite for RTL units
│
├── tools/
│   └── migration-analyser/       FPC/Delphi migration report tool (packaging=application)
│       ├── project.xml           depends on compiler module
│       └── src/
│           ├── main/pascal/
│           └── test/pascal/
│
├── vendor/qbe/                   Vendored QBE backend source (pinned, built from source)
└── docs/                         Design documents and specifications

PasBuild compiles each module itself target/ Subdirectory. The build output is never committed to the repository.

  • Free Pascal Compiler 3.2.2 or later (stable; does not require 3.3.x development snapshot)

  • passbuild

  • AC Compiler (gcc Or clang) to build the vendored QBE backend

  • gnu ld Or lld (Linux); ld (Mac OS)

PasBuild automatically resolves and compiles module dependencies.
rtlcompilertools/migration-analyser.

pasbuild compile -p debug      # includes -g -gl -Criot -gh
pasbuild compile -p release    # includes -O2 -CX -XX -Xs
pasbuild compile -m blaise-compiler

Once built, the compiler binary is on compiler/target/blaise.

# Compile a single file
compiler/target/blaise --source Hello.pas --output Hello

# Compile via project.xml
compiler/target/blaise --project project.xml --config debug --output myapp

# Emit QBE IR (useful for debugging the compiler itself)
compiler/target/blaise --source Hello.pas --emit-ir

Apache License v2.0 with runtime library exception. View license.


Built by Graeme with ❤️ for the Pascal community.

About this

A modern, self-hosting Object Pascal compiler built for 2020. Zero legacy, full ARC, and integrated UTF-8.

resources

license

Stars

watchers

forks




<a href

Leave a Comment