How logical pretest loop can be describe using denotational

How logical pretest loop can be describe using denotational semantics? Please explain with detail example.

Solution

Example of a recursive function and then apply the idea to 3 types of instructions.

We define the value of a binary number

<bin_num> à 0 | 1 | <bin_num>0 | <bin_num>1

Explicitly, a binary number is a 0, a 1, or recursively a binary number go behind by a 0 or a binary number followed by a 1

The function must map from a binary number derived since from the beyond grammar rule to a mathematical object is an integer value.

Tbin(<bin_num) =

Tbin(0) = 0                 

Tbin(1) = 1     

Tbin(<bin_num>0)=2*Tbin(<bin_num>)

Tbin(<bin_num>1)=2*Tbin(<bin_num>) + 1

Tbin(101) = 2*Tbin(10) + 1 = 2*(2*Tbin(1))+1 = 2*2*1+1 = 5        

Expressions

        Me (E, s)

            if VARMAP(i, s) = under for some   

                   i in E then error

            else E’, where E’ is the result of estimating   

                   estimating E after setting every

                   variable i in E to VARMAP(i, s)

Expression E, in state s, is an error if some i (variable) in E is undefined, otherwise it is E’ = value of estimating E by applying each variable I and operator in E applying VARMAP presently in s.

How logical pretest loop can be describe using denotational semantics? Please explain with detail example.SolutionExample of a recursive function and then apply

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site