[SOLVED] CS320 Assignment 6- Context Free Grammars

25.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon assign6-mpbn4q.zip (82.3 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
5/5 - (2 votes)

⟨id⟩ ::= a | b | c | … | z
⟨dig⟩ ::= 0 | 1 | 2 | … | 9
⟨expr⟩ ::= () | ⟨dig⟩ | ⟨id⟩
| let ⟨id⟩ = ⟨expr⟩ in ⟨expr⟩
| ⟨expr⟩ ; ⟨expr⟩
| begin ⟨expr⟩ end
Demonstrate the grammar above is ambiguous.
1
2. Modify the grammar (reproduced below) to be unambiguous. Hint: There is not just one way.
⟨id⟩ ::= a | b | c | … | z
⟨dig⟩ ::= 0 | 1 | 2 | … | 9
⟨expr⟩ ::= () | ⟨dig⟩ | ⟨id⟩
| let ⟨id⟩ = ⟨expr⟩ in ⟨expr⟩
| ⟨expr⟩ ; ⟨expr⟩
| begin ⟨expr⟩ end
Page 2
3. Demonstrate your modified grammar fixes the previously shown ambiguity.
Page 3

  • assign6-mpbn4q.zip