Posted in Information Technology & Systems, Total Reads: 353
Compiler is a computer program that converts high level computer program/code (written in simple English in human understandable terms) to machine code (written in terms of 0’s and 1’s). The machine code is further executed by the processor. For example if a code is compiled for certain platform say IBM platform, then it will work for all IBM compatible computers but not for any Apple Macintosh computers.
A compiler takes good amount of time to analyse the source code and convert it to machine code but the execution of machine code become much simpler and faster. A compiler loads the whole program into main memory before compilation and after scanning the program as a whole it generates the error message (if any). This makes it hard to debug and also debugging takes more time.
On the other hand Interpreter also converts high level code to machine code, but it is different from the compiler in many ways. It scans one statement at a time and thus it makes use of much lesser memory. It is also comparatively fast in analysing the code and generating error messages. However in execution the machine code generated by interpreter takes more time than a compiler. Also as the interpreter reads and translates the program continuously and stops when the error is met, so it is easy to debug.