>>> But even putting that aside, even if somebody wrote such a description, >>> it would be reductionism gone mad. What possible light on the problem >>> would be shined by a long, long list of machine code operations, even >>> if written using assembly mnemonics? >> >> Only that you've got a consistent, stable (and therefore, formalizable) >> translation from your language to the machine. > > You are mistaken to think that there is a single, one-to-one, mapping > between high-level code and machine code.
It's not mistaken. Given a stable and formalized language definition, there should only be continued optimization of the lexical and procedural constructs into better machine code. In the case of an "interpreted" language like Python (which I'll define as a language which includes a layer of indirection between the user and the machine, encouraging the nice benefits of interactivity), such optimization isn't really apropos, because it's not the purpose of python to be optimal to the machine as much as "optimal to the programmer". In any case, while such optimization can continue over time, they generally create new compiler releases to indicate such changes. The one-to-one mapping is held by the compiler. Such determinism *defines* the machine, otherwise you might as well get rid of the notion of computer *science*. All else is error, akin to cosmic rays or magic. Unless the source code changes, all else remaining equal, the machine code is supposed to be the same, no matter how many times it is compiled. >[Only if you use the exact source, compiler, switches, etc]] will the output >be the same. > And even that is not guaranteed. Oh, and what would cause such non-determinism? > Take, for example, the single high-level operation: > > sort(alist) > > What machine code will be executed? Obviously that will depend on the > sort algorithm used. There are *dozens*. Here are just a few: Well, since you didn't specify your programming language, you're then merely stating an English construct. As such, there can be no single mapping from English into the machine, which is why there are so many different languages and experiments that map your [English] concepts into source code. > Now sorting is pretty high level, but the same principle applies to even > simple operations like "multiply two numbers". There are often multiple > algorithms for performing the operation, and even a single algorithm can > often be implemented in slightly different ways. Expecting all compilers > to generate the same machine code is simply naive. You are both over-simplifying and complexifying things at once. Pick one. -- MarkJ Tacoma, Washington -- https://mail.python.org/mailman/listinfo/python-list