[Solved] COSC450/550 HW 2

30 $

File Name: COSC450/550_HW_2.zip
File Size: 150.72 KB

SKU: [Solved] COSC450/550 HW 2 Category: Tag:

Or Upload Your Assignment Here:


1. Write EBNF description for the following:a. A Java class definition header statementb. A C switch statement2. Rewrite the BNF of Example 3.4 (page120) to give + precedence over * and force + to be right associative.3. Using the grammar in Example 3.2 (page117), show a parse tree and a leftmost derivation for the following statement: A = A * (B + (C * A))4. Prove that the following grammar is ambiguous:<S> à <A> <B> <C><A> à <A> + <A> | <id><id> à a | b | c5. Write an attribute grammar whose BNF basis is that of Example 3.6 (page131) but whose language rules are as follows: Data types cannot be mixed in expressions, butassignment statements need not have the same types on both sides of the assignment operator.6. Using the virtual machine instructions given in Section 3.5.1.1, give an operational semantic definition of the following:a. Java do-whileb. C++ if-then-elsec. C for7. Compute the weakest precondition for each of the following assignment statements and postconditions:a. a = 2 * (b -1) – 1 {a > 0}b. b = (c + 10) / 3 {b > 6}c. x = 2 * y + x – 1 {x > 11}8. Compute the weakest precondition for each of the following sequences of assignment statements and their postconditions:a = 2 * b + 1;b = a – 3{b < 0}

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] COSC450/550 HW 2
30 $