News for hackers. Stuff that matters.
Re:Lexical differential highlighting instead of syntax highl... by zokier on Thursday July 11, 2019 @07:17PM (#20416770)
Complete tangent but one thing that I've wondered about modernish asm mnemonics is how complex they are, and especially how much type information they encode in a semi-structured way. Taking the authors example of PMULHUW, the core operation is MUL(tiply), P for packed integers, H for high result, U for unsigned, and W for word sized (16 bit). I feel like there must be a better way to express the same thing that wouldn't lead stuff looking like one word all caps alphabet soup. I don't know exactly what that would be, spelling out everything would probably make assembly way too verbose. So some sort of middle ground would be nice.
Re:Lexical differential highlighting instead of syntax highl... by chc4 on Thursday July 11, 2019 @11:18PM (#20417816)
> I feel like there must be a better way to express the same thing that wouldn't lead stuff looking like one word all caps alphabet soup.

Yes, that's called a programming language :^)

Assembly is usually essentially a macro engine over the actual instructions you are emitting for your processor, and the Intel x86 chip manuals or whatever you're targeting use the outrageously long proper names, so your assembly will too. Heck, the author mentions specifically reading assembly too, so knowing what you're reading is 1:1 with the actual instruction stream is helpful, no matter how bad the official names are.

Actual programming languages just abstract away some complex instructions like SSE vectorizing (which have famously terrible names) to some high-level API and intrinsic functions. And you should too.

Re:Lexical differential highlighting instead of syntax highl... by zokier on Friday July 12, 2019 @01:02AM (#20418320)
> the Intel x86 chip manuals or whatever you're targeting use the outrageously long proper names, so your assembly will too.

I don't see why that has to be the case; why I'd must use Intel specified mnemonics instead of my own syntax? While not as radical, the att vs intel syntax demonstrates that the vendor syntax is not the only option. As long as the syntax captures all the details of instructions to be completely unambiguous then it should be perfectly interchangeable.

I specifically do not desire higher level of abstraction because I want to maintain that 1:1 relation with the actual machine code. Heck, even Intel mnemonics do not truly have 1:1 relation to machine code, because the instruction (encoding) can depend on operand types.

Re:Lexical differential highlighting instead of syntax highl... by breck on Thursday July 11, 2019 @07:30PM (#20416833)
I’ve done some experiments with tree languages that compile to ASM. I think it’s definitely the way forward.
Re:Lexical differential highlighting instead of syntax highl... by okaleniuk on Friday July 12, 2019 @01:19PM (#20422394)
Actually, it would be interesting to experiment with coloring all the abbreviations separately. P, then MUL, then H, then U, then W (or UW altogether). Not sure if it works, but it's something worth trying.