Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1 Language specification 1.1 The While Language The syntax of While is defined a

ID: 3844431 • Letter: 1

Question

1 Language specification 1.1 The While Language The syntax of While is defined as follows: a ne l a l a1 a2 a1 a2 I a1 a2 by A b a S a. true false a1 a2 S a l skip S1; S2 if b S1 S. I while to S The semantics of arithmetic expressions is defined by function AI a A a State Z In I(s) (ar) 8 a1 a2 (s) A a1 (s) a2 (s) A a21(s) A a1 (8) X 10s) A a 1 (s) a2 (s) a1 a2 The semantics of boolean expressions is defined by function B b BI b State T BI true (s) true B false (s) false a2 Cs) JAL a1 J (s) AL a2 (s) (11 (s) a1 BD -b] (s) BI (s) false BI b1 A b2 (s)

Explanation / Answer

I have created and designed the Translation Function T and its correctness. I have included the comments for each part of section and attached the final output of it.

Let me explain you in simpler and in step-by-step manner:-

Step-1:

The initial part is correctness of an algorithm with respect to their specification. It is the Input-Output behaviour of a sytem in a translation function T.

Step-2:

The next step is to define the Translation function of an Axiomatic semantics like solving the logical mathematical in a system to prove its correctness in the computer programs.

Example:-

a) Operational Semantics,

b) Denotational Semantics, &

c) Axiomatic Semantics.

Step-3:

The final step is to abstract the machine M which deals with the State, Code and Stack.

Example:-

{ c, e, s } Code × Stack × State

Proof:-

PUSH-1 : FETCH-x : ADD : STORE-x

(PUSH-n : c, e, ) . (c, N[n] : e, )
(ADD : c, z1 : z2 : e, ) . (c,(z1 + z2) : e, )
(MULT : c, z1 : z2 : e, ) . hc,(z1 z2) : e, )
(SUB : c, z1 : z2 : e, ) . hc,(z1 z2) : e, )
(TRUE : c, e, i . (c, tt : e, )
(FALSE : c, e, i . (c, ff : e, )
(EQ : c, z1 : z2 : e, ) . (c,(z1 = z2) : e, )
(LE : c, z1 : z2 : e, ) . (c,(z1 z2) : e, )
(AND : c, t1 : t2 : e, ) .
{
(c, tt : e, )
(c, ff : e, )
}