Question No 1: Marks 20
Consider the following grammar for signed binary numbers (SBN):
The string -1 can be derived as follows:
(a) Similarly find out the derivation for the string “-11011” [10 marks]
(b) What attributes are needed for the attributed version of above SBN grammar. [5
marks]
(c) Fill out the following Code Snippet Table for the given SBN grammar “-11011”. [5
marks]
Productions Code Snippet
Note: Number of rows in table is not fixed; you need to add more rows as per the productions.
Consider the following grammar for signed binary numbers (SBN):
The string -1 can be derived as follows:
(a) Similarly find out the derivation for the string “-11011” [10 marks]
(b) What attributes are needed for the attributed version of above SBN grammar. [5
marks]
(c) Fill out the following Code Snippet Table for the given SBN grammar “-11011”. [5
marks]
Productions Code Snippet
Note: Number of rows in table is not fixed; you need to add more rows as per the productions.
Idea Solution Soon :
For -11011
Number → Sign List
→Sign List Bit
→ Sign List 1
→ Sign List Bit 1
→ Sign List 1 1
→ Sign List Bit 1 1
→ Sign List 0 1 1
→ Sign List Bit 0 1 1
→ Sign List 1 0 1 1
→ Sign Bit 1 0 1 1
→ Sign 1 1 0 1 1
→ - 1 1 0 1 1
