(This is the older material - click here - for current specification content)

12. Qualities of an interpreter

Advantages

1. Debugging

Imagine you are busy programmer and you want to make sure that each line of the source code you are typing in, is error free.

As we have mentioned, simple typos will trip you up, miss a comma, semi colon, bracket in the grammar of the high level language and you wiill see a long, de-moralising, list of errors to be fixed in your source code (many of which are spurious, adding to the hassle!). What if a program could check each line of code as you generate it.

This is one important role of interpreters, it makes debugging simpler as it immediately checks your source code.

2. Less memory

Another advantage is memory. It uses less memory than an exectuable file because only a few lines of source code needs to be in memory at any one time.

3. Less prone to crashing

Some interpreters execute code within a 'virtual machine'. For example the Flash Player and the Java Virtual machine. These have been designed to dis-allow code from directly accessing the computer. So you may crash the virtual machine with faulty code, but most likely the host computer will still be running just fine.

Disadvantages

The biggest disadvantage is speed. Interpreted code runs slower than compiled code.

This is because the interpreter has to analyse and convert each line of source code (or bytecode) into machine code before it can be executed.

 

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: Java Virtual Machine

 

Copyright © www.teach-ict.com