Compiler and Interpreter in Java and C programing

Compiler and Interpreter in Java and C programing

Main differences between a compiler and an interpreter - 

a. Compiler changes code written in an undeniable level programming language into the machine code, immediately, before program runs, though an Interpreter coverts every significant level program articulation, individually, into the machine code, during program run. Arranged code runs quicker while deciphered code runs more slow.

b. Compiler shows all mistakes after gathering, then again, the Interpreter shows blunders of each line individually.

c. Compiler depends on interpretation connecting stacking model, while Interpreter depends on Interpretation Method.

d. Compiler takes a whole program while the Interpreter takes a solitary line of code.

JAVA uses both compiler and interpreter as:

Java is first machine free programming language; it utilizes both compiler and mediator. Java compilers are planned so that converts source code into stage free structure I-e byte codes. These byte codes are then changed over to machine code by mediator. This is the means by which compiler and mediator both utilized in one language. Any framework having JVM will run these byte codes.

Java program byte code deciphered by VM machine language

Synopsis :

java compiler convert source code in to a middle of the road language known as bytecode. This bytecode just can be executed in a virtual climate called JVM. Java virtual machine. JVM is a translator to java bytecode. It changes over bytecode into machine language and executes line by line.

We should attempt to comprehend the progression of above program by the figure given underneath.

Steps of a Java Program Execution

How a C program is executed?

1) C program (source code) is shipped off preprocessor first. The preprocessor is mindful to change over preprocessor mandates into their particular qualities. The preprocessor creates an extended source code.

2) Expanded source code is shipped off compiler which incorporates the code and converts it into gathering code.

3) The gathering code is shipped off constructing agent what collects the code and converts it into object code. Presently a simple.obj record is produced.

4) The item code is shipped off linker which joins it to the library, for example, header documents. Then, at that point it is changed over into executable code. A simple.exe document is produced.

5) The executable code is shipped off loader which loads it into memory and afterward it is executed. After execution, yield is shipped off console.

Post a Comment

Previous Post Next Post