I read a lot about the comparison between compiler and an interpreter, but what i found that, compiler compiles a file into .obj file which after linking becomes .exe file.
But in the case of an interpreter, it interprets the code line by line and executes it directly...
My question is:- WHILE INTERPRETATION, HOW DOES THE INTERPRETER MAKES REFERENCE TO A LIBRARY FUNCTION OR A CODE THAT IS WRITTEN A LITTLE LATER THAN THE CURRENT CODE THAT IS BEING EXECUTED?
AND WHERE IS THE INTERPRETED CODE SAVED IMMEDIATELY AFTER EXECUTION? AS I HAD A DOUBT HOW CAN IT BE EXECUTED LINE BY LINE AS IT HAS TO MAKE SOME LIBRARY REFERENCES OR OTHER REFERENCES?

please please please help asap.

Interpreted code isn't necessarily executed line by line. In many cases it's compiled to an easier to run intermediate form (Java bytecode, for example). While an interpreter might be one program that reads and runs source code all at the same time, often you'll really have two programs under the hood: one to compile source code and one to run the compiled result.

In the case of library references, it really depends on how the interpreter works. If the libraries are in the same form as the source code, or an intermediate form, execution is a somewhat simple matter of handling multiple input files and piecing everything together into one monolithic instruction base. If the libraries really are in library form, such as a DLL, the interpreter's runtime environment needs to understand how to load and use such libraries.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.