I went down a deep rabbit hole (and I'm still falling). It started out with the idea of trying to compile into LLVM IR (and maybe WASM). Now I've jumped ships mid-course and changed to C as a target; I will probably, out of sheer perverseness, do Fortran as well. So this is decompilation of a stack-based assembly language into a non-stack-based higher-level language.

It's one of these "how hard can it be?" things.

The answer in short is, it's impossible; but there are degrees of approximation, and they are increasingly difficult. So it's a lot of fun.


My compiler now works on the Uxntal "Hello, world" so I guess that's it, job done ^_^

Let me introduce "nito", a proof-of-concept compiler from to C.

You can find it at codeberg.org/wimvanderbauwhede.

I might still do an actual LLVM IR backend, and will almost certainly do Fortran as it is too good to let pass.

@wim_v12e

> on_reset_while: 1; /* label needs statement */

That's horrible. I love it! :D

Follow

@pixelherodev By the way thanks for looking at it in that level of detail!

· · Web · 1 · 0 · 0

@wim_v12e Well I wasn't going to comment _without_ at least reading the README! >_>

@pixelherodev You're way ahead of lots of people on the internet with that attitude :-D

Sign in to participate in the conversation
Cybrespace

cybrespace: the social hub of the information superhighway jack in to the mastodon fediverse today and surf the dataflow through our cybrepunk, slightly glitchy web portal support us on patreon or liberapay!