|
I've got a long-term project of building an Oberon compiler. Oberon is a language in the Pascal family, the newest language from Wirth, and an attempt to remove any unnecessary features from his languages, indeed he went a little too far in some early versions of Oberon and restored a feature or two in successive versions. Mostly I've learnt a lot from building a compiler, in particular the back-end which I didn't have much experience with. But also I've started using Oberon more and more. My compiler targets the 65C816 processor, but I ended up porting the front-end to LLVM so that I had native oberon, and used it to build a number of tools, an emulator, and actually the compiler (there was a C intermediate step). In the end I've started to really like Oberon, and I don't miss much from more modern languages. I did add some extensions so I have a very simple form of object-orientation, and used it to implement a UI toolkit similar to AppKit, but much simpler. Some of the modern language features add more complexity than they give in benefits. And sometimes it's just better to write code than learn a new language feature or library. Plus it's a very readable language. |
Of all things...
I also have a (unpublished) '816 focused language and compiler (me and the AI).
I'm keeping it pretty conservative, as the goal is to rewrite the compiler in itself, and have it self-host. But a fellow posted this [1] about "Micron", an Oberon inspired system language.
And I'm giving a keen eye to how it handles Interfaces. I'm not sure if it will really fit, but it's an interesting idea that should be reasonably cheap on the compiler, and have no impact on the runtime.
I must say having an introspective CPU simulator as part of your unit tests can really help with writing a compiler. Not only can you test that the code is generating what it's supposed to, you can test that the code actually does what it’s supposed to.
[1] https://news.ycombinator.com/item?id=50413266