Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started