4 ms·
Translating assembly to machine code is a trivial compilation, but technically it is still compiling. Compiling is just translating source code in one language
by jrajav 14y ago
Translating assembly to machine code is a trivial compilation, but technically it is still compiling.
Compiling is just translating source code in one language into code in another.
- vitno 14y agonot really... Assembly is a one-to-one mapping with machine code. 2 (fast) passes, and you are done. Compiling entails far more complex operations. while I understand that you are saying that the action of assembling is just trivial compiling, I think that compiling implies, and perhaps even means, certain operations and steps that just aren't present in an assembler.
- ctdonath 14y agoLong-standing convention is assembling != compiling. You touched on the reason: compiling is translating one language to another. Assembly code is not changing language, just replacing symbols from human-convenient to machine-convenient, more like encryption. You wouldn't consider Pig Latin a different language from English, it's just a straightforward mangling thereof.
- dkersten 14y agojust replacing symbols from human-convenient to machine-convenient Its not quite a one-to-one mapping though. For example, there are assembly instructions which map to more than one opcode, depending on how it is used and opcodes can have various flags that change its encoding (prefixes and such), like the MOV x86 instruction. Beyond that, it is also rare to find assembly code which does not make use of macros or assembler-implemented pseudo instructions. http://stackoverflow.com/questions/2546715/how-to-analysis-how-many-bytes-each-instruction-takes-in-assembly/2761248#2761248 http://stackoverflow.com/questions/2546715/how-to-analysis-h...
- stephencanon 14y agoThere is a one-to-one map between a mnemonic plus its operands and the resulting opcode, which is the relevant criteria. The use of macros doesn’t change this (though the use of pseudo-instructions can, if they force islands to be created for constants or jump tables).
- CountHackulus 14y agoFor nearly any other assembly language, like say System 390 or PowerPC, it's a straightforward 1-1 mapping. Macros and pseudo instructions more fall into the real of text pre-processing than compiling.
- chc 14y agoIt's only barely more 1-1 than C to assembly is without any optimization steps. When you see a C program, you have a very good idea what the assembly will look like.
- aidenn0 14y agoNit-pick Power is many to one, not one-to-one (there is no "shift" machine code, but there is a rotate-and-mask machine code that shift operators are translated into).
- CountHackulus 14y agoI've written part of a compiler for Power and never used the shift machine code, maybe it's just the setup I was using, but I use rlwinm[.] all the time.
- namdnay 14y agotransliteration vs translation