Advertisement
MNikolovski

C vs I vs A

Oct 10th, 2017
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. Both compiler and interpreter convert human readable high level language like Java,C++ etc into machine language but there is difference in the way both function.
  2.  
  3. Compiler scans the entire program once and then converts it into machine language which can then be executed by computer's processor.In short compiler translates the entire program in one go and then executes it.
  4. Interpreter on the other hand first converts high level language into an intermediate code and then executes it line by line. This intermediate code is executed by another program.
  5.  
  6. The execution of program is faster in compiler than interpreter as in interpreter code is executed line by line.
  7.  
  8. Compiler generates error report after translation of entire code whereas in case of interpreter once an error is encountered it is notified and no further code is scanned.
  9.  
  10. Example Python is an interpreted language whereas C,C++ are compiled languages.Java however uses both compiler and interpreter.
  11.  
  12. Assembler is used for converting the code of low level language (assembly language) into machine level language.
  13.  
  14.  
  15. When you run javac HelloWorld.java java compiler is invoked which converts human readable code(Contents of .java file) to java byte codes(intermediate form). This bytecodes are stored in a special file(called Class file) with .class extension.
  16.  
  17. Finally when you run java HelloWorld java interpreter is invoked which reads these bytecodes line by line, convert it into machine language and execute it.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement