compiler-constructioninterpreterinterpreted-languagecompiled-language

Steps carried out in case of INTERPRETER and COMPILER


What exactly the difference between interpreted and compiled language.For example I want print the numbers from 1 to 100 .How exactly the sequence of operations takes place in case of interpreter and compiler.

Further,If possible please provide me the steps in according to Java language and C language

Thx


Solution

  • A compiled language is a language which converts the source code to machine code. Also known as a native application.

    An interpreted language is a language which converts the source code to some intermediate. During the execution of the program, an interpretor runs the source code. Interpreted languages tend to be, but not always are, significantly slower than compiled languages. They are useful, however, for portability.

    C is compiled, turning the source code:

    for (int i=1;i<=100;i++) { printf("%d",i); }
    

    into assembly, then into machine code. The processor fetches each machine instruction and executes it. This is very fast.

    Java, however, converts source code to an intermidiate byte code. At run-time, it is run on a "virtual-machine", which can be slower than a native compiled application.