how is compiler differ from interpreter?why they use differtly?can we combine it together as single unit?what r there purposes?
1)Compilers translates high-level instructions into machine language while Interpreter translates high-level instructions into intermediate code, and then executes the program.
2)Compiler usually takes a long time to analyze and process a program while Interpreter is comparatively faster at program analysis and processing.
3)Compiler results in an executable program that is a machine-specific form of binary code while Interpreter results in a form of intermediate code that is "interpreted" by another program.
4)Compilers results in a faster running program while Interpreter results in comparatively slow executing programs.
5)Compiler runs on any computer while Interpreter runs only on computers with an interpreter installed.
Compilers work with high-level languages, some of which are Java and C. Programmers generally write the code one line at a time with an editor and the resulting file is then run using a compiler specific to the particular language.An interpreter on the other hand translates the code line by line and executes each translated line immediately. Although interpreters do generate binary code, this code isn't compiled into a specific program as much as it is interpreted every single time the program executes. Some of the more familiar interpreted programs are BASIC and Visual Basic.
simple--- javacompiler compiles our java source code mean english language mean high level language and generates bytecode mean .class file mean machine understanding code mean 0 and 1 mean in binary format.because computer java leader JAVA VIRTUAL MACHINE understand only bytecode mean .class format.after that interpreter(or JIT COMPILER or logical name JVM) executes the BYTECODE mean .class file.bytecode executed line by line by the interpreter.line by line execution is time expensive.it will take much time.so they changed from interpreter to high JIT compiler(it is also interpreter but more benefits and fast than older),which executes bytecode all at a time instead of execute line by line.so so fast than old.not only that after any class compile if it gave compiler error ,and we solved that line error then onceagain run means then it executes from that error solved line instead of execute all.so fast and best performance than old interpreter(may be jdk1.3).So they introduced JIT compiler newly version may be JDK1.5.JVM IS LOGICAL NAME.JITCOMPILER IS PHYSICAL. MY SINCERE ADVISE TO ALL POSTERS PLEASE POST ALL ANSWERS IN SIMPLE ENGLISH FOR TO UNDERSTAND ALL PEOPLE instead of bookish grammer java words.