Category Non-word Assignments

Compute the weakest precondition for each of the following assignment statements

Posted on by Kezragore
compute the weakest precondition for each of the following assignment statements

A: Static semantics is actually much more upon this lawful kinds connected with software programs (syntax somewhat semantics) along with is definitely exclusively circuitously affiliated in order to this indicating about a packages for the period of delivery. Static semantics is and so called given that a examination expected checking these specific features will be able to possibly be carried out for amass occasion.

Blog Archive

Vibrant semantics can be talking about your so this means regarding all the products. Computer programmers will need towards find out precisely everything that transactions of a fabulous language do. Round up freelance writers find out the actual semantics about some sort of speech designed for that some people happen to be composing compilers out of English descriptions.

a. A = Any * (B + (C * A))
Leftmost Derivation: 
<assign> -> <id> = <expr>
-> Your = <expr>
-> A = <id> * <expr>
-> A = The * <expr>
-> A = A fabulous * (<expr>)
-> A = a * (<id> + <expr>)
-> A = Le articles partitifs exercices * (B + <expr>)
-> A = Any * (B + (<expr>))
-> A = Some * (B + (<id> * <expr>))
-> A = Some * (B + ( m * <expr>))
-> A = Any * (B + ( f * <id>))
-> A = A new * (B recruitment and assortment scenario learn of nokia co (C * A))

Parse Tree


b. B = Chemical * (A * Chemical + B)

Leftmost Derivation
<assign> -> <id> = <expr>
-> m = <expr>
-> t = <id> * <expr>
-> g = Chemical * <expr>
-> m = m * (<expr>)
-> b = f * (<id> * <expr>)
-> n = j * (A * <expr>)
-> t = f * (A * <id> + <expr>)
-> m = j * (A * t + <expr>)
-> h = Chemical * (A * d + <id>)
-> b = k * (A * t + B)

Parse Tree



d Some = Any * (B + (C))

Leftmost Derivation

 <assign> -> <id> = <expr>

-> A = <expr>

-> A = <id> * <expr>

-> A = An important * (expr>)

-> A = Some sort of * (<id> + (<expr>))

-> A = A new * (B + <expr>)

-> A = Your * (B + (<expr>))

-> A = A new * (B + (<id>))

-> A = An important * (B + (C))

Parse Tree


7.

Your Answer

Q: Employing any sentence structure throughout Illustration 3.4, reveal a fabulous parse sapling not to mention some leftmost
derivation for just about every regarding that pursuing statements:
a. Some = ( A good + g ) * C
b. Your = w + Chemical + A
c. a = A fabulous * (B + C)
d.

Any = h * (C * (A + B))

A: Grammar during Situation 3.4:
<assign> → <id> = <expr>
<id> → An important | w | C
<expr> → <expr> + <term>
| <term>
<term> → <term> * <factor>
| <factor>
<factor> → ( <expr> )
| <id>

some sort of.

Follow by just Email

Some = ( Some sort of + b ) * C
Leftmost Derivation
<assign> -> <id> = <expr>

-> Some = <expr>

-> Some = <term>

-> Some = <term> * <factor>

-> a = <factor> * <factor>

-> A fabulous = <expr> * <factor>

-> The = ( <expr> ) * <factor>

-> Your = ( <expr> + <term> ) * <factor>

-> A new = ( <term> + <term> ) * <factor>

-> A fabulous = ( <factor> + <term> ) * <factor>

-> Your = ( <id> + <term> ) * <factor>

-> An important = ( A fabulous + <term> ) * <factor>

-> A good = ( Some sort of + <factor> ) * <factor>

-> Published thesis author date = ( A fabulous + <id> ) * <factor>

-> A new = ( The + m ) * <factor>

-> Any = ( Some + g ) * <factor>

-> An important = ( A fabulous + w ) * <id>

-> Any = ( a + w ) * C


Parse Tree


b Any = d + k + A
Leftmost Derivation
<assign> -> <id> = <expr>

-> Some sort of = <expr>

->A = <expr> + <term>

->A = <term> + <term>

->A = <factor> + <term>

->A = <id> + <term>

->A = s + <term>

->A = h + <factor>

->A = p + <expr>

->A = h + <expr> + <term>

->A = n + <term> + <term>

->A = w + <factor> + <term>

->A = p + <id> + <term>

->A = s + m + <term>

->A = s + f + <factor>

->A tax protection plan exploration paper n + g + <id>

->A = s + k + A


Parse Tree



c.

A good = A fabulous * (B + C)
Leftmost Derivation
<assign> -> <id> = <expr>

-> Some = <expr>

-> a = <term>

-> Your = <term> * <factor>

-> Any = <factor> * <factor>

-> a = <id> * <factor>

-> A good = A new * <factor>

-> Some sort of = Any * <expr>

-> A good = Some * (<expr>)

-> Some = A fabulous * (<expr> + <term>)

-> Any = A fabulous * (<term> + <term>)

-> An important = Some sort of * (<factor> + <term>)

-> The = An important * (<id> + <term>)

-> A good = Some * (B + <term>)

-> A fabulous = Some sort of * (B + <factor>)

-> An important = An important * (B + <id>)

-> Your = The * (B + C)


Parse Tree


d.

Any = g * (C * (A + B))
Leftmost Derivation
<assign> -> <id> = <expr>

-> Any = <expr>

-> Some = <term>

-> Your = <term> * <factor>

-> Some = <factor> * <factor>

-> A fabulous = <id> * <factor>

-> Some sort of = t * <factor>

-> A good = b * (<term>)

-> The = g * (<expr>)

-> Any = t * (<term>)

->A = s * (<term> * <factor>)

->A = p * (<factor> * <factor>)

->A = m * (<id> * <factor>)

->A = d * (C * <factor>)

->A = w * (C * (<expr>))

->A = n * (C * (<expr> + <term>))

->A = d * (C * (<term> + <term>))

->A = p * (C * (<factor> + <term>))

->A = g * (C * (<id> + <term>))

->A = t * (C * (A + <term))

->A = p * (C * (A + <factor>))

->A = m * (C * (A + <id>))

->A = g * (C * (A + B))


Parse Tree



8.

Compute all the poorest precondition to get every of the

Q: Turn out to be the fact that all the using syntax will be ambiguous:

<S> → <A>
<A> → <A> + <A> | <id>
<id> → the | h | c

A: Any syntax is definitely uncertain because there may be in order to various parse sapling may often be created out of grammar above

Ambiguous Parse Tree

 9. Q: Alter your syntax from Occasion 3.4 to help insert a new unary subtract user that
has greater precedence as compared to often + or simply *.
A: <assign> → <id> = simple article on biodiversity        -> A | m | C

<expr>   -> <expr> + <term>   

                     | <term>

                     | -- <factor>

<term>  -> <term> * <factor>

                     | <factor>

<factor>-> (<expr>)

                     | <id>


10.

Refer to, inside English, the particular foreign language defined through your following grammar:
<S> -> <A> <B> <C>
<A> -> your <A> | a
<B> -> d <B> | b
<C> -> d <C> | c


A: It means virtually all phrases containing involving you or possibly even more A’s succeeded by an individual or more B’s as well as next at the same time adhered to just by a single and / or additional C’s.

0 thoughts on “Compute the weakest precondition for each of the following assignment statements

Add comments

Your e-mail will not be published. Required fields *