Sunteți pe pagina 1din 3

The Translation Process

1. Interpreter

• Source code is translated line by line and immediately executed.


• If errors exist they will cause an immediate halt.

Example

Interpreter translates
message from German
to English.

German sentence is English sentence is


spoken. INTERPRETER spoken.

GERMAN ENGLISH

Advantages
• Errors are quickly identified because each line is executed.
• Checks for both syntax and run-time errors.

Disadvantages
• Not a very efficient method which is time consuming especially when
errors are encountered.
• Each time execution takes place it must be recompiled.
• Code can be stolen and used by others.
The Translation Process

2. Compilation

• Known as ‘Batch Processing’ as an entire executable file is created.


• All errors are recorded and sent at the end.
• Commonly used by commercial packages.
• If changes are required then recompilation will be required.

Example

The translator converts


the German in a novel
for English

TRANSLATOR ENGLISH

Advantages
• A very quick method as machine code is stored.
• Storage is minimal because of machine code.

Disadvantages
• Only produces machine code if no syntax errors are present.
• Testing is a complex procedure.
• Code is hard to modify unless you have lots of experience.
• Errors only appear when the program has been compiled.
• Changes require the program to be recompiled.
The Translation Process

3. Incremental Compilation

• The aim is to reduce the time spent recompiling.


• Incremental compilers aim to reduce the translation time by only
recompiling those parts of code that have changed since the last compile
took place.

Example

The translator converts


the new changes into a
Changes new edition.

TRANSLATOR 2nd Edition

1st Edition

Advantages
• Commonly used modules are compiled and stored.
• Execution involves running the main line as interpreted code and modules
from the stored compiled code.

Disadvantages
• Portability is reduced.
• The programming environment must be able to keep track of any changes
to source code.

S-ar putea să vă placă și