Question: 1.Derive the requested strings and draw parse trees for the given expressions using the following grammar. -> + | | -> * | / |

1.Derive the requested strings and draw parse trees for the given expressions using the following grammar.

-> +

|

|

-> *

| /

|

-> | ( )

-> 0 | 1 | 2| 3 | 4 | 5 | 6 | 7| 8 | 9

a) 4 + 5 * 7 b) 4 + (5 * 7)

2. Prove that the following grammar is ambiguous.

->

-> + |

-> 1 | 2 | 3

3.Compute the weakest precondition for each of the following assignments

statements and postconditions

1. a =2*(b-1)-1 {a>0}

2. b =(c+10)/3 {b>6}

3. a = a+2 * b - 1 {a > 1}

4. x = 2 * y + x-1 {x > 11}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!