Thursday, 31 May 2012

Interpreter


Interpreter is a language translator, it take one statement of a high level language at a time and translate it into a machine instruction which is immediately executed.
Interpreters are easy to write and they do not require large memory space in the computer.
Unlike compiler it does not create an object code & store it.
Compiled programs generally run faster than interpreted programs.
Interpreter take little time to spent analyzing and processing the program.
Interpreter executes byte code line by line, and it converts byte code into Machine code. (Ex. Java)
Interpreter avoids the overheads of compilation. This is the advantage during program development, because a program may be modified.
To make an informed decision in practice we need a quantitative basis for a comparison of compilers and interpreters.
Tc  =average compilation time per statement
T= average execution time per statement
Ti  = average interpretation per statement
Let P is a program. The CPU time required to execute a program using compilation or interpretation is calculated by no. of statements and no. of statements executed in some execution of P.
Let size of program is 200. for a specific set of data, let program P executes as follows : 20 statements are executed for initialization purpose. This is followed by 10 iterations of a loop containing 8 statements, followed by the execution of 20 statements for printing results.
Statement execution = 20 + 10 * 8 + 20 =120
Total execution time using the compilation model
     = 200.Tc + 120.Te
   let Tc = 20.Te
  =206.Tc
Total execution time using the interpretation model = 120.Ti
Use of interpreters :
1.Efficiency in certain environments and simplicity.
2.It is better to use interpretation for a program.
3.In development environment interpreter is very fast.
4.Interpreter is a popular choice for commands to an operating system or an editor.
5.So many software packages use interpreter for interfaces.

1 comment:

  1. I have read your blog its very attractive and impressive. I like it your blog.

    Java Online Training Java EE Online Training Java EE Online Training Java 8 online training Core Java 8 online training

    Java Online Training from India Java Online Training from India Core Java Training Online Core Java Training Online Java Training InstitutesJava Training Institutes

    ReplyDelete