▲ | bxparks 3 days ago | |
Wow, that's going to take some time and effort to digest, but thank you. Yes, I think control-flow is easier to understand in assembly language than the implementation you showed in Forth. :-) | ||
▲ | kragen 3 days ago | parent [-] | |
Happy to help! I think you're mistaken about assembly language. In assembly language, the thing that plays the role of these definitions like if and then and ?<resolve is the assembler's symbol table and relocation logic, which goes back and changes your jump instructions (etc.) to jump to the places where it finds that your labels have been defined to point. Typically this involves things like hash functions, hash table collision resolution, various operand encodings for things like short jumps and long jumps, and so on. Although you can write an assembler that does all this in an afternoon, I don't think you will ever find an assembler whose implementation of all this functionality is easier to understand than the above 30 lines of code. It might be easier to understand per line of code but there will be a lot more lines of code to understand, like 10× or 100×. |