next up previous contents
Next: Interpreted code and performance Up: Introduction Previous: The TONS idea   Contents


``Interpreted'' code

A language interpreter can be a great many number of things, and in order not to confuse things too much I here defined what I mean when I write interpreted in this report.

A language interpreter is a piece of software that allows the end-user to write a program in some human-readable language, and have this program executed directly by the interpreter.

This is in contrast to language compilers, that translate the human-readable code into machine-readable code, so that the end-user can execute the machine-readable code at a later time.

Early interpreters parsed the human-readable code line by line, executing each line as it had been parsed. Loops, for example, would require the interpreter to parse the code lines within the loop in every iteration of the loop. Needless to say, this is both extremely slow (because it involves scanning and parsing of text all the time), and inconvenient to the programmer (because syntax errors are not discovered until the erroneous line is reached in the program).

Modern interpreters contain a built-in ``translator'', that initially parses the entire user program, translating the user-written code into some internal representation which is more easily used by the interpreter. This has the benefits of finding all syntax errors before execution begins, and it is usually orders of magnitude faster than the older approach.

When I refer to ``interpreters'' in this report, I do mean a ``modern'' interpreter. I know that the Perl language interpreter performs this translation before execution, I also implemented the TONS virtual machine that way, and from discussions with my supervisor Per Christian Hansen, we reasoned that MatLab does the same thing.


next up previous contents
Next: Interpreted code and performance Up: Introduction Previous: The TONS idea   Contents

1999-08-09