Semantics of the computer programming languages

In Data-processing theoretical, the formal semantic (of the computer programming languages) is the study of the significance of the Computer programs seen as mathematical objects.

Bond with linguistics

As in Linguistic, here the Sémantique indicates the bond between one meaning, the meant program, and one, mathematical object which will depend on the properties that one wishes to know of the program.

One will call also semantic the bond between the meaning language (the Computer programming language) and the meant language (Logique of Hoare, automats, or other).

Semantic usual of a computer programming language

The semantic ones most usually used to give direction to a computer programming language are the operational semantic , the dénotationnelle semantic and the axiomatic semantic .

Operational semantics

In Semantic operational, the significance of a program is the continuation of the states of the machine which carries out the program. In other words a program is regarded as the description of a Système of transition from states. In this semantics, programs:

a=1; b=0

and

a=1; b=0

are equivalent (have the same significance), but the program:

b=0; a=1

is not equivalent for them (even if with final the result is the same one, the actions do not take place in the same order).

One can abstract this semantics by observing only part of the memory of the machine, or for example by observing only the exits with the screen (the trace of the program).

Dénotationnelle semantics

Initiated by Christopher Strachey, the dénotationnelle Sémantique is an approach in which a mathematical Fonction called denotation is associated with each program, and represents to some extent its effect, its significance. This function takes for example for argument the state of the memory before execution, and has as a result the state after execution.

In this semantics, all the examples given above for operational semantics are equivalent, but the program:

a=1; b=1;

is not equivalent for them.

There exist several alternatives of the dénotationnelle semantics, of which one of most famous is the dénotationnelle semantic by continuation which, instead of associating with a program a function which transforms the memory, associates a function to him which transforms the Continuation (future) of the machine after execution of the program into the continuation before execution of the program.

One of the important aspects of dénotationnelle semantics is the property of compositionnality : the denotation of a program is obtained by combination of the denotations of its components.

Axiomatic semantics

In Semantic axiomatic, the program is nothing any more but one transformer of logical properties on the state of the memory: if there is p true before execution, then there is afterwards Q true. One is not interested any more at the precise state of the memory as long as one can say if the property holds.

If the property which interests us, it is to know if has and B is positive after execution of the program, then all the preceding examples are equivalent to the direction where whatever the state of the machine before execution of the program, the property at exit holds. What one notes in Logique of Hoare:

\a=1; b=0 \ {has \ geq 0 \ and B \ geq 0 \}

Relationship between the different semantic ones

These three semantic, as the examples suggest it, is not completely independent from/to each other, indeed:
  • two syntactically equivalent programs are it operationally;
  • two operationally equivalent programs are it dénotationnellement;
  • and two programs dénotationnellement equivalent are it axiomatiquement.
But the reciprocal ones are false.

Thus one can treat on a hierarchical basis the semantic ones by saying that a semantics is the abstraction of another if and only if two equivalent programs in the last are it also in the first. These relations were formalized by the theory of the abstract Interprétation.

One can supplement this hierarchy (partial order) on semantic equivalences, while placing at the top the identity (two programs are identical if and only if, they are the same continuation of characters), and all in bottom, the coarsest abstraction which one calls the chaos , where any program is equivalent to any other program.

Random links:Origne | Jose Galvez FBC | Algorithm of bakery | Roseline Tremblay | Abominable Homer of snows | Vie_de_famille_en_littérature