You are on page 1of 2

NAME: UZOESHI FORTUNE ONYEKACHI

COURSE-CODE: CMP 401


COURSE-TITLE: organization of programming language
ASSIGNMENT
QUESTION:
Discuss extensively on the three formal methods of describing semantics.
ANSWER
1. Operational Semantics: Operational semantics uses the idea that the languages are abstract
machines and evaluation of a program is a series of state transitions from an initial to a final
state.

Transition function defines how states transits to the next, if there is one. If there is no such
next state, the machine either completed its evaluation successfully or faced a runtime
error and got stuck. The program halts in both cases.

Every term in computer program has some meaning, and its form finalizes when the state
transitions are complete. State transitions may be single or multi-step.
There are two major ways to write operational semantics which are small-step or big-step

Small-step semantics breaks down behaviour into granular simplification steps. A


simplification step might not guarantee evaluation to a finalized form: sometimes multiple
steps are needed

Big-step semantics composes multiple small-step rules that evaluate into finalized form into
a single rule. Such a rule is equivalent with its multi-step counterpart.

Since operational semantics is styled after abstract machine behaviour, they’re useful as a
reference for implementation.

2. Denotational semantics: Denotational semantics uses the idea that languages are
mathematical objects. Unlike operational semantics evaluation and Implementation details
are abstracted away.

An interpretation function is defined to map terms in a program to elements in semantic


domains (also known as its denotation), removing any occurrence of its original syntax.
Semantic domains are designed to model after specific language features and this study is
called domain theory.
Checking whether two programs are the same is achievable by comparing their denotations.

Laws can be derived from semantic domains and are used for language specifications to
verify correctness of an implementation.

The properties of semantic domains can be used to show impossible instances in a


language.

3. Axiomatic semantics: Intuitively related to Hoare Logic. Instead of deriving laws from
operational or denotational behaviour definitions, the laws themselves define the semantics
of the language.
This reversal simplifies reasoning about a program, leading to developments in software
verification. Two different program implementations with the same set of initial and final
assertions (laws) are considered to have the same semantics.

Assertions define relationship between variables and other moving parts in a program, and
some of these assertions remain invariant throughout execution. This is the important
invariance concept that underlines axiomatic semantics.

You might also like