Both @Sporarum’s and @tarsa’s ideas sound very laborious and expensive to me, especially the idea of paying a security firm to audit generated JavaScript code. As they say, the problem is that you eventually run out of other people’s money.
I think a more promising approach is to stick much closer to how Scala was originally bootstrapped.
- As @Kordyjan pointed out in the other thread (Bootstrapping of the Scala compiler - #5 by Kordyjan), the original bootstrap compiler for Scala 2.0 was Scala 1.4. The source code for that is available in git: GitHub - scala/scala at v1.4.0+4 · GitHub
- It is written in Pizza and compiled using the PiCo compiler. As @SethTisue has helpfully pointed out, the PiCo source code is available on GitHub these days.
- unfortunately, it’s self-hosting, so now we would have to bootstrap Pizza… And while the Pizza compiler is available on SourceForge, it is again self-hosting, and I haven’t been able to find the pure-Java bootstrap compiler for Pizza
- and I don’t even know if the Pizza compiler is able to compile PiCo
- Since bootstrapping Pizza doesn’t seem viable, a different route is needed.
- Pizza is essentially a Java dialect with a few additional features: ADTs, pattern matching, lambdas, operator overloading. Most of these have made it into modern Java by now, and hence…
- it should be feasible to translate most of the Pizza-specific features into their modern Java equivalents
- LLMs should make short work of that
- Once we have a Scala 1.4 compiler written in (modern) Java, we can use it to compile Scala 2.0 and then work our way through subsequent releases
Ideally the whole process would be automated using GNU Guix, as that seems to be the most advanced ecosystem for automated bootstrapping. Needless to say it’s still an ungodly amount of work that’s unlikely to happen without funding, but it’s probably the most realistic approach, and also more faithful to Scala’s history.