2016-05-03 19:17 plasm [permalink]
Look! It's my first parser in javascript: http://yoy.be/dev/plasm.html
It is also a play thing to try and tame this beast that is assembler. Not any assembler in particular, but just in general what it is to try and make things work with a limited set of registers and instructions and having to shuffle anything that doesn't fit in those to and from memory. If I put more work into this, it could go two ways:
I can evolve the machine code further and try to design a binary encoding for the possible instructions, and have the code turn up in the memory as it is accessed by the normal registers. (It is not now, the I
register now indexes into a separate set of instructions, possibly with overlapping values.)
Otherways I could try and build a compiler that compiles code into this set of machine instructions (perhaps based on this one), finding out along the way what is all the fuss about register allocation and heuristic optimizations...
And ofcourse the both meet and I could try to build a compiler straight into these virtual machine instructions, but I have the luxury of not having to do this. And since it's all about learning and exploring by doing, it'll probably get me stuck faster.
But for now I think I'll let this rest for a little while. See how it looks when I come back to it after a while.
See also https://github.com/stijnsanders/plasm