Interpreter | Compiler |
---|---|
Translates code line by line. | Runs through whole program to generate an .exe file. |
Reads faster but executes slower. | It takes more time to scan code but afterwards execution is faster than with an interpreter. |
No intermediate code generated. | Intermediate object code that calls for linking, which in turn uses up more memory. |
Translation stops at first error. | It throws an error message after scanning the entire code. |
Input in the form of Single statements | The whole program is the input in compiled languages. |
Html/Javascript widget
Sunday, 4 June 2017
Interpreter and Compiler
A compiler is a computer program responsible for translating a source code into a language form that can be directly run by the computer. There's though a minor difference between translator and compiler: a translator converts a program from its formal source code to a specific target language. Compilers are a special sort of translators which take program code often written in a high level language to run as machine code or intermediate code (e.g.: Bytecode, .NET-Code etc). This difference between translator and compiler isn't always pronounced in all cases. Programming languages such as C and C++ are compiler-based as they generate an exe file (if you're using windows) after being successfully compiled. An interpreter, on the other hand, doesn't convert source code into a portable format that can be run in a specific platform or system. Rather, an interpreter reads a code line by line and produces an output on a client or server platform. Interpreters need a specific environment setup in order to work properly. Examples of interpreted languages include Javascript and PHP.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment