Depending on what exactly you mean by "rewrite it", you might be interested in the discussion in this thread on how different pieces of Racket are put together:
Hello all,
I was curious what it would take to "reimplement Racket". As a Scheme derivative, it has a small core language[1], but this includes only the language and no standard library. I found a nice folder[2] of tables with about 1700 primitives in the Chez Scheme implementation that might suffice as the minimal standard library.
It looks like the main language-level differences compared with e.g. SICP Scheme are:
Syntax objects: (quote-syntax)
Modules. Including multiple phases, since (…
In particular:
Implementing a similar macro expander is maybe not that difficult, but building a separate and fully compatible macro expander is probably not practical. That would be similar to building a RnRS Scheme implementation that is not merely a drop-in replacement for another according to the standard, but would work for every use of the other Scheme implementation. So, for the foreseeable future, any compatible and practical implementation of Racket is just going to use the main implementation of the macro system.
I heartily second the recommendation for Matthew's talk in that video, “Let’s Build a Hygenic Macro Expander”.
2 Likes