Live data from Hacker News

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

github.com

31–40 of 59 posts

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

#32
Initially, I was skeptical and thought that this is the millionth vibe-coded project that will die once the author gets bored.

However, when I checked who the author is, I found he is is Graeme Geldenhuys, the author of the fpGUI library [1]. He surely has a lot of experience with FreePascal and the Pascal language, and in these years he has proven to be a committed worker (fpGUI exists since 2010!). So, this project seems to start on good grounds!

I really hope it will gain traction, as I have often wondered myself why somebody would not create a “clean” Pascal compiler from scratch with no legacy cruft and good defaults (e.g., UTF-8 strings, inline variable declaration).

[1]: https://fpgui.sourceforge.net/

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

#34

Excited to see another project targeting the QBE back end, from what I can tell it's a great lightweight alternative to LLVM.

Yes it has been fantastic to work with QBE so far. It's way simpler than LLVM, giving you about 70% of the LLVM performance, for 10% of the effort. :)

Only downside is Windows support.

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

#35

Initially, I was skeptical and thought that this is the millionth vibe-coded project that will die once the author gets bored. However, when I checked who the author is, I found he is is Graeme Geldenhuys, the author of the fpGUI library [1]. He surely has a lot of experience with FreePascal and the Pascal language, and in these years he has proven to be a committed worker (fpGUI exists since 2010!). So, this project…

Thank you. fpGUI is 20 years old this year! :-D

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

#36

Looks interesting. As someone who's been using Pascal since Turbo Pascal 6, and use Delphi daily at work, I'm not sure I quite get the "COM-style interface GUID" objection. What exactly about it is complex, and how do you implement Supports() without it?

It's magic! ;-)

Not wanting to go into too much technical details: Blaise's interface system uses TypeInfo pointers as identity tokens. Meaning manually added GUIDs are not needed.

The two Supports() forms. Delphi has two overloads:

// 1. Boolean test function Supports(AObject: TObject; const IID: TGUID): Boolean;

// 2. Combined test + assignment (the useful one) function Supports(AObject: TObject; const IID: TGUID; out Intf): Boolean;

In Blaise, without GUIDs, the second argument is an interface type identifier rather than a GUID. The most natural design is to treat Supports as a compiler intrinsic (like is/as) rather than a library function, because the second argument isn't a runtime value — it names a type.

So Blaise code looks like this:

if Supports(Obj, IFoo) then ... // boolean test if Supports(Obj, IFoo, FooRef) then ... // test + assign fat pointer

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

#37

Looks interesting. As someone who's been using Pascal since Turbo Pascal 6, and use Delphi daily at work, I'm not sure I quite get the "COM-style interface GUID" objection. What exactly about it is complex, and how do you implement Supports() without it?

Not the OP, but I can answer with an objection to COM-style GUIDs myself. Delphi's interfaces are heavily based around COM, and so you need GUIDs, ARC, etc. But interfaces as a concept don't require the COM backend. If you want your code to be cleanly separated, but don't want to split ownership/management models* (create/free vs ARC), and have no need for an interface and type identity to be managed outside your cod…

And FPC also supports interfaces without GUIDs via the {$interfaces CORBA} directive, and it too, supports the Supports(...) construct just fine.

Delphi is just very Windows-centric with a lot of things they do.

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

#38
post #7

For me the only reason to use pascal is GUI apps but this doesn't have it.

fpGUI Toolkit will be made to work with Blaise.

[1] Homepage (terrible looking): https://fpgui.sourceforge.net/ [2] Github repo: https://github.com/graemeg/fpGUI/ The Discussion area has some interesting conversations and screenshots.

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

#39
That looks cool. If they support binary releases on macOS Apple Silicon I will try it out.

I wrote one major project in UCSD Pascal on Apple II 45 years ago: my Honnibo Warrior Go Playing program. For its time, a fantastic dev environment.

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

#40
post #27

Can this compile these games? https://jxself.org/git/supernova.git https://jxself.org/git/beyond-the-titanic.git Ok, there's no way to bootstrap it without FPC... can the compiler compile itself?

Every new compiler needs to be bootstrapped by something - unless you head straight into Assembly Language from day1 - but I'm not that crazy!

Yes, Blaise reached self-hosting after just 7 days. Meaning it could compile itself, and was byte-for-byte identical to the bootstrapped version. The language was absolutely barebones, but that's not the goal at that stage. The first (FPC) compiled binary is called the Stage 1 binary. That binary then compiles the compiler code to make a Stage 2 binary (a read Blaise compiler binary). Then Stage 2 compiles the compiler code again to make a Stage 3 binary. Self-hosting is when the stage-2 binary and stage-3 binaries are byte-for-byte identical. Blaise has already achieved that.

I'm currently actively working on removing the FPC and GCC bootstrap requirements. After which Blaise would become it's own bootstrap compiler.

Post reply on HN