Programming Languages

Types of Programming Language

Compilers and Interrupts

Procedural Programs

Object-orientated Programs

Declaritive Language

HideShow resource information

Types of Programming Language

Most program are written in general-purpose programming languages. These can be categorised by:

Imperative (Procedural) - e.g. PASCAL, C

Declaritive - e.g. PROLOG - developed for artifical intelligence (AI) systems

Functional - e.g. LOGO - consists of a series of functions and rules.

Object-orientated Programming - e.g. Visual Basic - developed to implement programs using WIMP. Executed when an event happens.

1 of 10

Forth Generation Programs

A forth generation language allows the program to be developed by creating the desired or output visually. The code is then generated automatically.

Thisdiffers from third generation language all the code has to be typed in by hand.

2 of 10

Special-purpose Languages

A number of languages have been developed for specific problems:

- PROLOG was developed specifically to solve AI problems.

- There are special languages for simulation such as Simula, they have special requirements to deal with queues and changing the time and date under the control of the program.

- There are special authoring programs that allow the development of teaching materials.

- Another specialist area is the development of web pages. There are also special forth generation languages that allow the development of web pages very quickly.

3 of 10


A compilier takes a computer program (the source program) and translates it into machine code (the target program). There are three main steps of the process:

Source Program

Lexical Analysis

Syntax Analysis

Code Generation

Target Program

4 of 10

Lexical Analysis

The purpose is to convert the source program into a series of token that are passed on to the Syntax Analysis.

The functions that the lexical analysis might perform include the following:

- Removing white space - white space is all program code that is superfluous to the meaning of the programs and includes comments, spaces, tabs and new-line characters.

- Identifying the individual words, operators etc. (Known as syntactic units) in the program.

- Create a symbol table. The symbol table will contain details of each symbol used in the program. A symbol might be a function name, a variable name, etc. The Symbol table will be used by the later stages of the compiler. It will contain the symbol name plus information about the item, e.g. an Integer, a procedure.

- It keeps track of line numbers.

- It produces an output listing.

- Each Reserved word, operator, etc. will be converted into a token to be passed to syntax analyser.

5 of 10

Syntax Analysis

The syntax analyser attempts to make sense of the program. There are two parts to this process:

- syntax analysis

- semantic analysis

Syntax analysis discovers whether the program consists of valid statements defined by the grammatical rules of the language, e.g. does a statment start with a semi-colon.

It is possible to have a statement that is synatically correct but has no meaning. Semantic analysis checks that the statements have some correct meaning.

6 of 10

Code Generation

After Syntax analysis the last stage is to generate the code.

It may include an optimiser that takes the code and modifies it so that it executes more quickly and/or uses less memory.

It is also possible to generate machine code that will execute on a different type of customer. This is known as CROSS-COMPLILATION.

7 of 10


An interpreter executes each line of code as it comes to it in the source program. Inorder to do this it has the following parts:

- Lexical Analysis

- Syntax Analysis

- Execution

The lexical analysis and the syntax analysis phases are similar to the compilier but the interupter does not generate any code.

8 of 10

Advantages of a Compiler

- A compiled program will always execute more quickly than one that is interpreted, as the interpeter has to understand every statement as it comes to it.

- The target program (called the object program) can be stored on disk and re-executed without being recompiled.

- Programs can be distributed in machine code form. This stops the user from modifying the program as they do not have access to the source code.

9 of 10

Advantages of an Interpreter

- Interpreters are useful for program development when execution speed is not important. As the interpreter is in command of the execution process debugging features can be built in.

- It uses less memory than a compiler.

10 of 10


No comments have yet been made

Similar Computing resources:

See all Computing resources »See all resources »