azzeloof / supercon-2022-badge-vm

GNU General Public License v3.0
0 stars 1 forks source link

huge refactor in assembler.py #3

Closed hexagon5un closed 1 year ago

hexagon5un commented 1 year ago

Wanted to get rid of the match/case statements, because they will force people to update Python to a version that's more recent than most will have. (E.g. Ubuntu users are still all on 3.9, probably more so with Winders.)

I didn't mean for it to get so out of hand, but when I saw that it was basically a lookup table with a few different handler versions, I had to do it.

no harm meant.

azzeloof commented 1 year ago

This looks beautiful but since we're leaning towards implementing Mike's anyway let's hold off on merging this one for now (unless anyone has strong feelings otherwise) (or even weak feelings tbh)

hexagon5un commented 1 year ago

I think that's right.

Honestly, I woke up the next morning and didn't like the changes. I went too far, and in the name of "streamlining" the code, made it arguably shorter and more elegant, but harder to read if you're just stepping into it. That's a bad tradeoff for demo code.

And I don't think there's much for you here that will be useful for the emulator either, especially if you're doing the machine-code version. Honestly, the assembly language translation is dancing around a whole bunch of (in this case, ambiguous) linguistic stuff, like the difference between R0, [R0], and [0x0], which is a design flaw in the language, IMO.

So yeah. Dead end. :) Was a fun couple hours of coding anyway.