- #1
opus
Gold Member
- 717
- 131
I'm learning Python in my introductory Computer Science class and I'm going over high-level languages- more specifically, Interpreters vs Compilers.
To my understanding, when we write in a high-level language, which a computer does not understand, we write what's called a source code or source program. For the computer to understand this source code, it needs to be translated into machine code via an Interpreter or Compiler.
The main differences, from what I can see, between an interpreter and compiler is that compilers add an extra step. That is,
Interpreters take the source code, translate it to machine code, and executes this statement immediately and one statement at a time.
Compilers take the source code, translate it to machine code via a compiler, then from here I am confused. From what I can tell, after it's been translated into machine code, it now uses an "executor" to run the program.
So my question is two fold. First, is my understanding of compilers correct? And second, what's the point of the extra step with compilers? What benefit does that have?
To my understanding, when we write in a high-level language, which a computer does not understand, we write what's called a source code or source program. For the computer to understand this source code, it needs to be translated into machine code via an Interpreter or Compiler.
The main differences, from what I can see, between an interpreter and compiler is that compilers add an extra step. That is,
Interpreters take the source code, translate it to machine code, and executes this statement immediately and one statement at a time.
Compilers take the source code, translate it to machine code via a compiler, then from here I am confused. From what I can tell, after it's been translated into machine code, it now uses an "executor" to run the program.
So my question is two fold. First, is my understanding of compilers correct? And second, what's the point of the extra step with compilers? What benefit does that have?