CS606 – Compiler Construction

Assignment # 02

Fall 2019

Total marks = 20

Deadline Date

2nd December, 2019

Please carefully read the following instructions before attempting assignment.

RULES FOR MARKING

It should be clear that your assignment would not get any credit if:

The assignment is submitted after the due date.

The submitted assignment does not open or file is corrupt.

Strict action will be taken if submitted solution is copied from any other student or from the internet.

You should consult the recommended books to clarify your concepts as handouts are not enough.

You are supposed to submit your assignment in .doc or docx format.

Any other formats like scan images, PDF, zip, rar, ppt and bmp etc will not be accepted.

OBJECTIVE

Objective of this assignment is to increase the learning capabilities of the students about

• Context-Free Grammars

• Ambiguous Grammars

• Unambiguous Grammars

NOTE

No assignment will be accepted after the due date via email in any case (whether it is the case of load shedding or internet malfunctioning etc.). Hence refrain from uploading assignment in the last hour of deadline. It is recommended to upload solution file at least two days before its closing date.

If you find any mistake or confusion in assignment (Question statement), please consult with your instructor before the deadline. After the deadline no queries will be entertained in this regard.

For any query, feel free to email at:

[email protected]

Questions No 01 10 marks

Consider the grammar given below:

NP -> Adj NP

NP -> NP Conj NP

NP -> Adj N

NP -> N

Adj -> Young

Conj -> and

N -> Boys | Girls

Where “Young, and, boys, Girls “ are terminals and “NP, N, Adj, Conj” are non-terminals.

Prove or disprove that the grammar given above is ambiguous.

Questions No 02 10 marks

Consider the grammar given below:

```
S -> S + S | S / S | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19
```

Prove that above given grammar is ambiguous.

Good Luck!