Blaise – A modern self-hosting zero-legacy Object Pascal compiler targeting QBE

原始链接: https://github.com/graemeg/blaise

Hacker Newsnew | past | comments | ask | show | jobs | submitloginBlaise – A modern self-hosting zero-legacy Object Pascal compiler targeting QBE (github.com/graemeg)8 points by peter_d_sherman 1 hour ago | hide | past | favorite | 1 comment help superdisk 1 minute ago | next [–] Looks cool and does aim to address some of the annoying warts in Pascal. Especially the memory model.reply Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact Search:
相关文章

原文
Feature Reason for removal

ShortString, AnsiString, WideString, UnicodeString

Replaced by a single UTF-8 reference-counted string type

with statement

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

Old-style object types

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

COM-style interface GUIDs

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

Multiple language modes

One dialect, maintained well, beats five dialects maintained poorly

assign, reset, rewrite, blockread

Replaced by a stream-based I/O RTL

TObject vs TInterfacedObject split

One unified class model under automatic reference counting; [Weak] breaks cycles

The core architecture is still being finalised, so the project is not yet accepting code contributions. Feedback on language design, syntax choices, and the future direction of Blaise is very welcome — please use the Discussions tab on GitHub.

This project uses PasBuild’s multi-module layout. Each subdirectory with a project.xml is an independent module; the root project.xml is the 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 to its own target/ subdirectory. Build output is never committed to the repository.

  • Free Pascal Compiler 3.2.2 or later (stable; 3.3.x development snapshots are not required)

  • PasBuild

  • A C compiler (gcc or clang) for building the vendored QBE backend

  • GNU ld or lld (Linux); ld (macOS)

PasBuild resolves the module dependency order automatically and compiles 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 at 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. See LICENSE.


Built with ❤️ for the Pascal community by Graeme.

About

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

Resources

License

Stars

Watchers

Forks

联系我们 contact @ memedata.com