Quote:
Originally posted by G.I.Josh@Oct 10 2004, 03:24 PM
I stopped focusing on Python for a while and started reading a lot of Linux docs; but I just now decided to get back into programming. It got me thinking about how interpreters work. Do they take the instructions as they get them, convert them to ml in ram, and send it to the cpu, or do they not have to convert it at all?
Thanks,
Josh
|
Interpreters take as input an executable specification and produce as output the result of executing the specification. This is different than a compiler because a compiler takes as input a source program, and translates it into a target program. The interpreter does examine the input program and determines whether or not it is a valid program, both an interpreter and compiler build an internal model of the structure and meaning of a program, both determine where to store values during execution, however interpreting the code to produce a result is quite different from emitting a translated program than can be executed to produce a result. The modern day languages (Java, Perl 6) use a compiler to create an intermediate representation, and then they use an interpreter (or another compiler than an interpreter) to execute the program.