Nora - an experimental implementation of Racket using LLVM/MLIR

Hi all,

I have opened up some code I have been working on for RacketFest.
This is Nora, an experimental implementation of Racket using LLVM/MLIR.

You can find it here:

For discussion, you can now use the new discord channel or GitHub discussions if you prefer a more question/answer format.

See you around!

Paulo Matos

8 Likes

I don't understand how advanced is the project. Can it run simple racket programs? Hello Word? Fibonacci? FizzBuzz?

Does it uses a (tracing) garbage collector like racket or reference counting?

2 Likes

Good question!

This is early days. So yes, it can run some programs but it currently does not GC - so you cannot actually run anything that you would consider practical. Also, it relies on the Racket expander and it will continue to do so in the near future.

The current focus is to finish the interpreter and develop a set of dialects that can step-wise take us from Racket Linklets Dialect (NIR - Nora Intermediate Representation) to LLVM Dialect. This will probably take the rest of the year. I don't see Nora compiling practical examples before 2024.

Interpret - yes, compile - not yet! My personal milestone is to have one of those examples compiling for RacketFest 2024. :crossed_fingers:

2 Likes

The expander is very tricky, and @mflatt makes some backward incompatible tweaks every 5 years (like the syntax dye or the scopes). It would be painful to keep it in sync. The transition from Racket 6 to Racket 7 was mostly about porting the expander from C to Racket, and it took more than a year to fix all the corner cases. So my recommendation is to reuse the expander of racket, and add some trick to break the cycle (IIRC racket BC has an pre-expanded version in the repo, and CS has a pre-compiled of the bytecode in a side repo.) Everything with a .rkt extension is fair game :slight_smile: .

Thanks for the comments. That's exactly what I am doing. I have a precompiler linklet of the expander in the nora repository and will use that updating from racket on a regular basis. :slight_smile:

Doesn't LLVM come with a few built-in GCs? It might be easier to use one of those than build one from scratch.

EDIT: Never mind, LLVM doesn't actually come with a GC.

That is correct. LLVM IR provides hooks for GC but doesn't provide the implementation for one.

@pmatos posted on #nora on Racket Discord chat:

I have now added the Nora announcement video from Racketfest 2023 here: https://www.youtube.com/watch?v=8YE6kJXvuaQ
I have a few more videos planned, which is why I created a specific channel for Nora.

1 Like