-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Opcode mnemonics for SubX #39
Comments
Con: tooling will take code to implement, code that will add to the complexity of the codebase readers have to navigate. |
Would mnemonics (for individual concrete om op codes, eg add_immediate) via a basic table lookup be in any significant way more complex than the literal hex numbers? |
Depends on how you think of complexity.
Neither of these is a deal-breaker. I think there may be value in names that are conveniences but don't try to perfectly hide opcodes. And linear scan is fine when a table is just ~100 entries long. The bulk of time will be spent on string comparisons anyway. Would you be interested in coming up with names for all the mnemonics? The complete list is in the |
I'll try and find time to have a go - maybe as you suggest by reworking what's needed for a small example first, to get a feel for the different syntaxes. Surely without mnemonics a user (programmer) will still need to consult a table for help looking up the code for the desired op? |
Very happy to hear it. Looking forward to seeing what you come up with. While reading code, an unfamiliar programmer will hopefully see all the existing code formatted and documented in a consistent manner so no table lookups are needed. While writing code, I think an unfamiliar programmer will have to consult a table anyway. I'd like for it to be a single table, and not two tables. Or more precisely, I'd like them to have to perform only a single mapping in their minds, rather than two. I'm starting to think it can be done with mnemonics. My first priority is the unfamiliar programmer who is new to this codebase. So I'm very conscious that my choice of opcodes may seem easier to me than to others. That makes your feedback and this ticket very valuable. By the same token, once you or someone designs a mnemonic system, it may seem easier to you than to others (since you created it). As a first cut, it'll be interesting to see how I react to it (which is partly why I'd like for someone else to take the lead in designing it). But it'll also be interesting to see what questions others have over time. Incidentally, I'd recommend sticking to a single name for each opcode for now, rather than trying to add syntax like |
Giving mnemonics to x86 opcodes might make SubX easier for newcomers to read. This issue is intended to track the pros and cons.
Previous discussion: https://news.ycombinator.com/item?id=21268252#21293301
Initial list of pros and cons:
8d
for8f
seems easier than typoingcopy
forpop
.add
for another.The text was updated successfully, but these errors were encountered: