Home » Ask & Discuss » Other Courses » Computer Applications « Back to Discussion



Computer Applications

ravi's Avatar
New kid on the Block

Joined: 18 Sep 2008
Post: 28
16 Dec 2008 20:57:53 IST
0 People liked this
4
691 View Post
differenciate between compiler and interperter
None

differenciate between compiler and interperter


Share this article on:

Comments (4)

Saurabh  Jha's Avatar

Cool goIITian

Joined: 20 Nov 2008
Posts: 51
16 Dec 2008 21:11:18 IST
3 people liked this

compiler compiles the whole program in one go to object program but interpretar runs each line one by one.
compiler is not needed everytime in the memory once the program has compiled but interpretar is needed everytime.
compiler show all the errors in source code @ one go but interpretar does not it halts @ the point where there is error n do not show other errors after that.

compiler cannot be used for debugging of program but intrepreator can be used.
Vikram Saxena's Avatar

Forum Expert
Joined: 1 Apr 2007
Posts: 3391
17 Dec 2008 17:47:57 IST
0 people liked this

compiler..


 


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). The original sequence is usually called the source code and the output called object code. Commonly the output has a form suitable for processing by other programs (e.g., a linker), but it may be a human-readable text file.



The most common reason for wanting to translate source code is to create an executable program. The name "compiler" is primarily used for programs that translate source code from a high-level programming language to a lower level language (e.g., assembly language or machine language). A program that translates from a low level language to a higher level one is a decompiler. A program that translates between high-level languages is usually called a language translator, source to source translator, or language converter. A language rewriter is usually a program that translates the form of expressions without a change of language.



A compiler is likely to perform many or all of the following operations: lexical analysis, preprocessing, parsing, semantic analysis, code generation, and code optimization.


 


interpretor...


A program that executes instructions written in a high-level language. There are two ways to run programs written in a high-level language. The most common is to compile the program; the other method is to pass the program through an interpreter.



An interpreter translates high-level instructions into an intermediate form, which it then executes. In contrast, a compiler translates high-level instructions directly into machine language. Compiled programs generally run faster than interpreted programs. The advantage of an interpreter, however, is that it does not need to go through the compilation stage during which machine instructions are generated. This process can be time-consuming if the program is long. The interpreter, on the other hand, can immediately execute high-level programs. For this reason, interpreters are sometimes used during the development of a program, when a programmer wants to add small sections at a time and test them quickly. In addition, interpreters are often used in education because they allow students to program interactively.



Both interpreters and compilers are available for most high-level languages. However, BASIC and LISP are especially designed to be executed by an interpreter. In addition, page description languages, such as PostScript, use an interpreter. Every PostScript printer, for example, has a built-in interpreter that executes PostScript instructions.

prahalad agarwal's Avatar

Hot goIITian

Joined: 26 May 2007
Posts: 128
17 Dec 2008 18:08:01 IST
0 people liked this

The Interpreter and Compiler


The first phase of preparing a program for the computer to execute is the entry of the program instructions at an appropriate language level, and this will usually be done with a text editor as already described. The language used to describe the procedure to be followed is almost always quite different from the machine language level. Thus some form of translation from one language level to a lower level is required. In the early days of electronic computers, this was done by hand assembling the machine instructions to execute each high level instruction. One of the first routine tasks to be automated was the process of such a translation, resulting in either an interpreted or a compiled execution environment for the program.


The distinction between the terms interpret and compile arises when we consider that most useful tasks in scientific computing involve highly repetitive instruction sequences, usually called loops of one form or another. For a program which involves significant looping, the process of translating from the high level language to the machine level for each iteration can consume a large fraction of the computer time, while for a program that does not have to execute many repetitive instructions, the cost of interpreting is relatively low.


When efficiency is critical, the compiled language approach is usually better, in part because of the elimination of the repeated translation task after the first cycle through a loop. A further significant improvement to be gained from the compiled approach is that the translation program, usually called the compiler, can be allowed to analyze the whole program, or at least large parts of it, to determine details of its structure which then allow optimization of the program. This usually results in significant improvement in efficiency, without the detailed intervention of the user. This feature cannot be implemented in the interpreted approach, since the interpreter cannot, by its definition, have significant information concerning the global structure of the program.


It is frequently useful to use both the interpreted and compiled approaches during program development, since the interpreted approach allows very fast incremental improvements to the program, which can then be compiled for actual production use. A prime example of such an approach is with the LISP language, where development is done in a LISP interpreted environment, and well tested modules can then be compiled by the LISP compiler and integrated back into the LISP interpreter. This hybrid approach forms the basis of many LISP applications, such as computer algebra systems, to be discussed later. While this approach can be used with languages like C and FORTRAN, there are frequently complications in the transition from interpreted to compiled programs. Of course the BASIC language was initially designed as an interpreted language, and the resulting low performance was later improved by adding the ability for the language to be compiled.


Recently developed languages that have been designed to be interpreted include JAVA, TcL/Tk, PERL, and Python, among others. Some of these languages have been designed from the outset to allow a simpler form of compiling called byte compiling. The target in this form of compiling is not a specific hardware machine, but a simple and well defined intermediate level machine which is a virtual machine. While this virtual machine is not implemented in hardware, its specification is available to software designers, leading to the development of the implementation of the virtual machine on any hardware platform and any operating system. This approach provides many advantages at the possible cost of slightly slower execution. An important influence on the design of these byte-compiled languages is the device-independence required for programs that must run properly on any machine connected to the Internet. A program written and byte-compiled in JAVA, for instance, can be run on any computer and operating system that have the byte-code interpreter specified in the JAVA design. The implementation of this interpreter is the responsibility of the local host computer. This local host can thus control access to its own resources by carefully watching the byte-codes as they arrive, and allowing execution of only those instructions that do not threaten the integrity of the local system. Good design can provide high security from outside attack by hackers, but sloppy design can lead to a computer system that is easy prey for outside hackers.


Hope it will help u


CHEERS!!!

Vikram  Srivastava's Avatar

New kid on the Block

Joined: 18 Feb 2008
Posts: 11
20 Jan 2009 23:07:44 IST
1 people liked this

above written ans are good but simpaly interperater converts hll to lll line by line & compiler converts that whole at once



Quick Reply


Reply

Some HTML allowed.
Keep your comments above the belt or risk having them deleted.
Signup for a avatar to have your pictures show up by your comment
If Members see a thread that violates the Posting Rules, bring it to the attention of the Moderator Team
Free Sign Up!

Preparing for IIT-JEE ?

Arihant Revision Package for IIT JEE - Books, Practice Tests + Rank Predictor


@ INR 1,995/-

For Quick Info

Name

Mobile No.

Find Posts by Topics

Physics.

Topics

Mathematics.

Chemistry.

Biology

Parents

Board

Fun Zone

Sponsored Ads