You are browsing as a guest. Sign up (or log in) to start making projects!

8h 10m 41s logged

I accidentally made a pesudo-compiler. AGAIN. Also, I hate numbers now.

So, I’m working on a parallel implementation of an esoteric-ish assembly language called subleq. The defining feature of which is that it only has a single instruction, Subtract and jump if Less than or EQual to zero (hence the name). At first, I thought this was going to be a simple project. Maybe 4 hours writing the implementation and 2 hours writing a frontend. Boy, was I wrong.

At first it was all going to plan, I had most of it done. I just needed to write a few demo programs for multiprocessing and then I plonk it into web assembly and give it a UI. Then the worms started talking to me. They said, “you know how painful writing subleq by hand is, you should make some helper functions, like you had when you first learned about subleq.” So I made a few functions, addition, subtraction, jumping, and inverting values. But then I heard the worms voice, echoing from the distance, “Multiplication and division would be easy, and it would mean you could find primes.”

Condemnation directly to number hell

The worms lied to me, as they often do. It was in fact not easy. Multiplication was less painful. Its just repeated addition. BUT, i have to deal with negatives. So, the simpler of the two became spaghetti. And that was the east one! Next it was time for division. Division (and it’s twin, modulo) legitimately could have been most of this time. I’m not exactly sure how my division routine works, because it was written at midnight. But what I can tell you is that it involves magic numbers, loops, and subtracting zero from zero. Also it broke my compiler, flinging the function pointer directly into my variables, requiring multiple patch jobs to the division function and my compiler. But now! Finally! I have a working calculator!

Now to parallelize…

0
1

Comments 0

No comments yet. Be the first!