Question munyaradzi Computing & ICT

The Difference Between Interpreters and Compilers

distinguish between interpreter and compiler?

Did you know that we write custom assignments? We have experts in each specific subject area with vast experience. Get a complete answer and find out more about our writing services.

Answer Internal Staff

Both interpreters and compilers are used to translate source code into object code. Although they both achieve the same end objective, the method in which they do so is substantially different.

Interpreters

• Input a single instruction at a time.

• No intermediate representation (code that provides a programmer with ability to optimise the code based on the target machine).

• Control statements (‘If’ statements) are slow to execute.

• Errors are displayed for every interpreted instruction making them both easy to notice but slow to produce.

• Interpreters require less memory to function as no intermediate code is created.

Compilers

• Input the entire set of instructions at once.

• Provide intermediate representation.

• Control statements are faster to execute.

• Errors are not produced after each instruction meaning that the compiling is fast, but mistakes are often difficult to notice.

• Compilers require more memory as they create intermediate code.

Conclusion

Essentially the main difference between the two is their level of approachability and in the case of varied target machine architecture, their practicability. For novices, interpreters may be slower but they provide an easier method for detecting errors in source code and aid in producing an error free object code. Compilers on the other hand for experienced users provide a much quicker method of producing object code, however they do not provide the same degree of problem recognition. The addition of intermediate code produced by compilers also allows a programmer to tailor their code to particular target machines, often making compilers more practical.