Q:

Compiler versus Interpreter

So, let me see if I get this clearly or not.

When we say the differences between a compiler and an interpreter is that an interpreter translates high-level instructions into an intermediate form, which it then executes.
[I think the compiler also translate high-level instructions into an intermediate form but at this moment it generate the object code instead of executing it, right?]
An interpreter reads the source code one instruction or line at a time, converts this line into machine code and executes it.
[The interpreter itself doesn't convert the code to machine code, it evaluates the instruction (after that had been parsed) using ist own precompiled functons. E.g. Add expression in the high-level language will be evaluated using the interpreter add function which has been previously compiled, right?]

A:

The key difference is this: An interpreter processes the source code as it runs it. It does not convert the source into machine code, it simply uses its own code to accomplish what the source directs. A compiler converts the source code into machine code that can be run directly.
Not all compilers are separate from the execution process. For example, most Java run-times include a "JIT compiler" that compiles Java code while it's running, as needed.
You can have things in-between. Essentially, a process similar to compiling can be used first to convert the source code into something smaller and easier to interpret. This compiled output can then be interpreted. (For example, a first pass could convert, say 'if' to 53, 'else' to 54, 'for' to 55, and so on -- this will save the interpreter from having to handle variable-length strings in code that doesn't actually deal with strings.)

A:

I would agree with the first, although it is not necessarily true that the interpreter is working on one line at a time (it could do optimizations based on knowledge of the whole code).
The second I think is slightly off: the compiler does create "machine code" (which could be byte code, for a JVM).  The interpreter executes parts of its own program based on the input (so far same as compiler), which executed parts are performing the computation described in the input (as opposed to performing computation to calculate the needed machine code).
It is possible to blur the lines between the two as a compiler can generate code that will be interpreted at the time of execution (to provide runtime optimization based on factors that are not available at compile time)

