# Semantics

Semantics describes the process a computer follows when executing a program in a given language by describing the relationship between input and output. Or an explanation of how the program will run on different platforms (creating a model of computation).

In computer science and programming it is the field concerned with reigorous mathematical study of the meaning of programming languages. It does so by evaluating the meaning of syntactically valid string in the given language. Showing teh computation involved. In cases where evaluation of syntactically *invalid* strings are required, the result would be non-computational.

Formal semantics helps to write compilers better understand what a program is doing, and to prove, e.g., that the following if statement

```
if 1 == 1 then S1 else S2
```

has the same effect as S1 alone.

The field of formal semantics encompasses the following:

- The definition of semantic models
- The relations between different semantic models
- The relations between different approaches to meaning
- The relation between computation and the underlying mathematical structures from fields such as logic, set theory, model theory, category theory, etc.
- It has close links with other areas of computer science such as programming language design, type theory, compilers and interpreters, program verification and model checking.