0

This question already has an answer here:

I have been wondering, if every program is based on machine code, can we not decompile a program until it hits machine code and make it up to real programming languages?

How to decompile exe files with a rate of 100%? If my computer understands the processes it should take, isn't it also be able return me the steps of what's its done, values from memory exc..?

How do I decompile an exe file without an error?

marked as duplicate by perror, julian, Paweł Łukasik, kn0x, Community Nov 4 '17 at 19:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

6
  1. I have been wondering, if every program is based on machine code, can we not decompile a program until it hits machine code and make it up to real programming languages?

    This question is based on a false premise; namely that every program is based on machine code. Programs are typically written in high-level languages, which are by design architecture independent and therefore must be translated into an architecture-specific form in order to be executed:

    • “High-level” programming languages take their name from the relatively high level, or degree of abstraction, of the features they provide, relative to those of the assembly languages they were originally designed to replace. The adjective “abstract,” in this context, refers to the degree to which language features are separated from the details of any particular computer architecture.1

    • Machine independence is a fairly simple concept. Basically it says that a programming language should not rely on the features of any particular instruction set for its efficient implementation.1

    Programming languages are examples of formal languages:

    The translation of the series of statements written in a programming language in a program source file to semantically equivalent object code is accomplished by a compiler. Decompilation involves translation of architecture-dependent object code to a semantically equivalent representation (source code) that is not architecture specific, the reverse process of compilation.

  2. How to decompile exe files with a rate of 100%?

    This does not seem to be possible.

    Certainly, fully automated decompilation of arbitrary machine-code programs is not possible -- this problem is theoretically equivalent to the Halting Problem, an undecidable problem in Computer Science. What this means is that automatic (no expert intervention) decompilation cannot be achieved for all possible programs that are ever written. Further, even if a certain degree of success is achieved, the automatically generated program will probably lack meaningful variable and function names as these are not normally stored in an executable file (except when stored for debugging purposes).2

Further description of the challenges posed for decompilation can be found here:

In fact, correct disassembly (much less decompilation) is a major challenge:


1. Scott, Michael L. Programming Language Pragmatics. 3rd ed. Page 111

2. Is Decompilation Possible?

Not the answer you're looking for? Browse other questions tagged or ask your own question.