Sie sind auf Seite 1von 4

FROM SOURCE CODE TO OUTPUT

All computer programs must be converted / translated / compiled / interpreted into machine language before the computer's CPU can execute the instructions.

The source program comprises code written in a programming language such as BASIC, Pascal, C and so on. Depending on the level of programming language, the corresponding type of Translator will convert the source code to object code which is stored in the matching language program. This code is now at the point where the instructions can be executed by the computer to produce the output.

Types of translators

Source Program Source Code is the language or words that we use to write the program. Just as English, or French or Spanish, or German is the language that people use to write with, then Pascal is one language that is used to write programming code. This code is called Source Code. The rules of the language (called syntax) must be followed, in our example, it is the Pascal language. Again, just as English, and those other languages have their own grammar rules, such as spelling and sentence construction, Pascal programming language is no different. So you write your program using the required rules of the language that you are using. Source code is the programming code that is written in either:

a low-level programming language such as assembly language, or a high-level programming language such as BASIC, Pascal, C, C++, etc.

Translating the Source Code Translators are responsible for converting the source code into machine code for the computer to execute. The shaded gray areas above show the different types of translators that are used to convert source code to machine language code. If the source code was written using:

an assembly language program, then an assembler is needed to convert it to machine language code a high-level language program such as Pascal, then either a compiler or an interpreter could be used for the conversion.

Since we have a choice of a compiler or an interpreter, let us look at these two in more detail: Comparison of a compiler and an interpreter Compiler How is the source program translated? How often is the source program translated? Can the object code be stored for later use? The entire program is translated before execution Each line of programming code is translated once into object code and kept for execution later Interpreter Each line of the program is translated and run before the next programming line is translated and run Each line of the source code must be translated into object code every time the program is executed (run)

No, the object code must be translated Yes, the object code can be stored and from the source code each time it needs to executed (run) later be executed (run).

Executing the Object Code This is the machine language code that can now be executed by the computer to follow the instructions and produce some output. Sometimes, when a program is compiled, there are various sub-programs in object code that are created. Before executing the object code, these subprograms must be linked together to form one set of object code.

Maintaining programs Programs need to be kept up to date, or maintained in order to remain useful. Maintaining a program can involve adding extra tasks, entering more data of a different form or outputting data in a different format. Other examples include a tax rate may need to be changed or a zip code may need to be added.

Das könnte Ihnen auch gefallen