Question:

Differentiate between a compiler and interpreter? ?

by  |  earlier

0 LIKES UnLike

Differentiate between a compiler and interpreter?

 Tags:

   Report

6 ANSWERS


  1. A compiler breaks down high level code into machine language and generates a binary to be executed.

    An interpreter interprets code or can also break into down to a level between high level and machine language then another program will be used to execute the code.

    Compilers: Borland products, Mingw

    interpreters: java, .Net products where they creates byte code to be interpreted by another program or virtual machine


  2. This line is getting more and more blurred as time goes on.  These days there are native-code compilers, intermediate-code compilers, just-in-time compilers, and interpreters and all sorts of flavours of these.

    A compiler reads the human readable source file and generates an executable program.  A native-code compiler generates an executable that will run directly on the computer it was compiled for.  Most C / C++ compilers are native-code compilers.  I will talk about other types of compilers a little later.

    A native-code compiler has to compile the entire project before starting execution, making it slower to develop, but because the executable is being generated in the machine code the computer uses natively, it can run very fast.  Also, the resulting file can be examined and optimized to make it even faster and use less resources.

    An interpreter reads the source file and determines what each instruction means as it executes it.  This means that each time a line of source code is encountered, it must be translated before being executed.  Old versions of Basic and all pretty much all modern scripting languages are interpreted.

    Because the interpreter does not have to generate an executable before starting the program, development in interpreted languages can be a lot faster.  The drawback is that the program generally runs a lot slower using an interpreter than when compiled.  Global optimizations are also not feasible with an interpreter, so that keeps it slow.  Also, in order to run your program, the interpreter must be installed on the target system.

    This does lead to one more advantage of interpretted languages:  If you have an interpreter for that computer system (such as Windows, Mac, Linux, Unix, etc.), then your program can run on it.  This is not true for native-code compiled programs, which will only execute on the computer system they were compiled for.

    To try to get the best of both worlds (the portability of interpretted programs but the optimizations of compiled programs), intermediate-code compiling was developed.  In these languages, the compiler generates instructions, not for the computer you are on, but for an interpreter, sometimes called a virtual machine, that actually reads the compiled program and figures out what to do with each instruction.  Pascal and Java are examples of this strategy.

    With the advent of faster computers (and peripherals and humans not getting as fast as quickly), just-in-time (JIT) compiling was developed.  In this strategy, the source code is read like with the interpreter, but only the parts that are being executed get compiled, not the whole thing all at once.  The .NET architecture uses this strategy, along with intermediate-code compiling.  After the VB.NET or C# program is compiled to the intermediate-code, the .NET virtual machine reads the resulting compiled program and compiles only the parts it is about to execute to native code.  The next time it encounters those instructions, it just uses the native code that it created in the last pass.

    Hope this helps.

  3. A compiler is a computer program (or set of programs) that translates text written in a computer language (the source language) into another computer language (the target language).

    An interpreter normally means a computer program that executes, i.e. performs, instructions written in a programming language.


  4. Compiler will translate your programming source code to executable before running the program. When you run the program, the compiler will not stay in memory. A interpreter will translate your source code to runable instructions at the run time. The interpreter will be in memory and running as overhead.

    Compiler - C, C++, java

    Interpreter - Basic, Php

    Good lock,

    peng

    Got everything on http://www.eptop.com

  5. a compiler checks the code and compiles it as a whole. an interpreter goes line by line. compiler generated programs generally runs faster than interpreted ones, but compiling requires more RAM space than interpreting.  

  6. Compiled: pre-assembled environment (Java family, C, C++, ...)

    Interpreter: read commands on demand (php, asp, ,...)

Question Stats

Latest activity: earlier.
This question has 6 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.