Hire Our Expert Programmer & Technical Writer to do your Capstone Project
+1 vote
176 views
in Programming Languages & Algorithms by

1 Answer

+1 vote
by
selected by (user.guest)
 
Best answer

The denotational semantics of a program could be defined in terms of state changes in an ideal computer. Operational semantics are defined in this way, and denotational semantics are defined in nearly the same way. In a further simplification, however, denotational semantics is defined in terms of only the values of all of the program’s variables. So, denotational semantics uses the state of the program to describe meaning, whereas operational semantics uses the state of a machine. The key difference between operational semantics and denotational semantics is that state changes in operational semantics are defined by coded algorithms, written in some programming language, whereas in denotational semantics, state changes are defined by mathematical functions.

Let the state s of a program be represented as a set of ordered pairs, as follows:

s = {<i1, v1>, <i2, v2>, . . . , <in, vn>}

Each i is the name of a variable, and the associated v’s are the current values of those variables. Any of the v’s can have the special value undef, which indi- cates that its associated variable is currently undefined. Let VARMAP be a function of two parameters: a variable name and the program state. The value of VARMAP (ij , s) is vj (the value paired with ij in state s). Most semantics mapping functions for programs and program constructs map states to states.

These state changes are used to define the meanings of programs and program constructs. Some language constructs—for example, expressions—are mapped to values, not states.


Related questions

+1 vote
0 answers 122 views
+3 votes
1 answer 2.8k views
+1 vote
1 answer 3.0k views
Welcome to CPENTalk.com

Disclaimer: Every user is solely responsible for anything that he/she posts or uploads on CPENTalk.
...