+ 1
whats the difference between compiler and intepreter?
2 Respuestas
+ 6
It's a bit difficult to give an exact description. Basically you use a compiler to convert source code that cannot be interpreted as is into machine code before deployment. An interpreter can convert the source code live, so it doesn't need to be precompiled into an executable.
+ 3
Compilers
Compilers were the first sort of translator program to be written. The idea is simple: You write the program, then hand it to the compiler which translates it. Then you run the result.
Interpreters
An interpreter is also a program that translates a high-level language into a low-level one, but it does it at the moment the program is run. You write the program using a text editor or something similar, and then instruct the interpreter to run the program.
It takes the program, one line at a time, and translates each line before running it:
It translates the first line and runs it, then translates the second line and runs it etc.
Compiler characteristics:
spends a lot of time analyzing and processing the program
the resulting executable is some form of machine- specific binary code
the computer hardware interprets (executes) the resulting code
program execution is fast
Interpreter characteristics:
relatively little time is spent analyzing and processing the program
the resulting code is some sort of intermediate code
the resulting code is interpreted by another program
program execution is relatively slow