logoalt Hacker News

whartung • today at 9:52 PM • 1 reply • view on HN

> My compiler targets the 65C816 processor

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


Replies

jdswain • today at 10:07 PM

I also had the goal of self hosting, and that is working, although I have made it a little easier on myself by extending the 65C816 in some small ways. The most significant for the compiler is a small extension to the registers so that the direct page and stack can be located anywhere in memory. This is primarily to allow larger operating system and app images, the compiler is quite large now so it needs this. I have a limit of 64k for each module.

One breakthrough in the compiler was when I could start to use AI to interpret instruction traces, before that I was doing it by hand and it took a very long time. Now the AI pinpoints my errors very quickly, although I'm past that stage now and don't often come across compiler errors. I do this with an emulator, also written in Oberon.