<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[CS606 Assignment 2 Solution and Discussion]]></title><description><![CDATA[<p dir="auto">CS606 – Compiler Construction<br />
Assignment # 02<br />
Fall 2019	<br />
Total marks = 20</p>
<p dir="auto">Deadline Date<br />
2nd December, 2019</p>
<p dir="auto">Please carefully read the following instructions before attempting assignment.</p>
<p dir="auto">RULES FOR MARKING<br />
It should be clear that your assignment would not get any credit if:<br />
	The assignment is submitted after the due date.<br />
	The submitted assignment does not open or file is corrupt.<br />
	Strict action will be taken if submitted solution is copied from any other student or from the internet.</p>
<p dir="auto">You should consult the recommended books to clarify your concepts as handouts are not enough.</p>
<p dir="auto">You are supposed to submit your assignment in .doc or docx format.<br />
Any other formats like scan images, PDF, zip, rar, ppt and bmp etc will not be accepted.</p>
<p dir="auto">OBJECTIVE<br />
Objective of this assignment is to increase the learning capabilities of the students about<br />
•	Context-Free Grammars<br />
•	Ambiguous Grammars<br />
•	Unambiguous Grammars</p>
<p dir="auto">NOTE</p>
<p dir="auto">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.</p>
<p dir="auto">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.</p>
<p dir="auto">For any query, feel free to email at:<br />
<a href="mailto:cs606@vu.edu.pk" target="_blank" rel="noopener noreferrer nofollow ugc">cs606@vu.edu.pk</a></p>
<p dir="auto">Questions No 01								            10 marks</p>
<p dir="auto">Consider the grammar given below:<br />
NP -&gt; Adj  NP<br />
NP  -&gt; NP  Conj  NP<br />
NP -&gt; Adj  N<br />
NP -&gt; N<br />
Adj -&gt; Young<br />
Conj -&gt; and<br />
N -&gt; Boys | Girls</p>
<p dir="auto">Where “Young, and, boys, Girls “ are terminals and “NP, N, Adj, Conj” are non-terminals.<br />
Prove or disprove that the grammar given above is ambiguous.</p>
<p dir="auto">Questions No 02   								            10 marks</p>
<p dir="auto">Consider the grammar given below:</p>
<pre><code>           S  -&gt; S + S | S / S | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19
</code></pre>
<p dir="auto">Prove that above given grammar is ambiguous.</p>
<p dir="auto">Good Luck!</p>
]]></description><link>https://community.secnto.com//topic/731/cs606-assignment-2-solution-and-discussion</link><generator>RSS for Node</generator><lastBuildDate>Mon, 08 Jun 2026 19:59:25 GMT</lastBuildDate><atom:link href="https://community.secnto.com//topic/731.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 03 Dec 2019 14:21:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CS606 Assignment 2 Solution and Discussion on Tue, 03 Dec 2019 14:25:46 GMT]]></title><description><![CDATA[<p dir="auto">Ideas Solution<br />
Q No 01<br />
Solution:<br />
NP -&gt; Adj NP<br />
The draw parse trees for above given grammar:<br />
<img src="https://i.imgur.com/cR7P0Ng.png" alt="3ed24217-a089-4cd3-85e7-56389d10ccf9-image.png" class=" img-fluid img-markdown" /><br />
The above given grammar have only one parse tree so it is non-ambiguous grammar.<br />
NP  -&gt; NP Conj NP<br />
The draw parse trees for above given grammar:<br />
<img src="https://i.imgur.com/wflQD6P.png" alt="1c473269-1c88-4ba5-84d6-ab5169f94657-image.png" class=" img-fluid img-markdown" /><br />
The above grammar has two different parse trees therefore the given grammar is ambiguous.</p>
<p dir="auto">NP -&gt; Adj N<br />
The draw parse trees for above given grammar:<br />
<img src="https://i.imgur.com/IueNDrQ.png" alt="ee704f9a-b021-483a-864b-b72abc0a1c4a-image.png" class=" img-fluid img-markdown" /><br />
The above given grammar have only one parse tree so it is non-ambiguous grammar.<br />
NP -&gt;N<br />
The draw parse trees for above given grammar:<br />
<img src="https://i.imgur.com/zjft37X.png" alt="fe99c1ab-1959-4c17-b112-e347d177268b-image.png" class=" img-fluid img-markdown" /><br />
The above given grammar have only one parse tree so it is non-ambiguous grammar.<br />
Adj -&gt; Young<br />
The draw parse trees for above given grammar:<br />
<img src="https://i.imgur.com/zylKfdU.png" alt="3bfc0b07-1dc1-4f40-ace6-49718f09b14f-image.png" class=" img-fluid img-markdown" /><br />
The above given grammar have only one parse tree so it is non-ambiguous grammar.</p>
<p dir="auto">Conj -&gt; and<br />
The draw parse trees for above given grammar:<br />
<img src="https://i.imgur.com/4UWakYM.png" alt="bb56b34a-9ec9-4499-bd8e-d0b877b19b93-image.png" class=" img-fluid img-markdown" /><br />
The above given grammar have only one parse tree so it is non-ambiguous grammar.</p>
<p dir="auto">N -&gt; Boys | Girls<br />
The draw parse trees for above given grammar:<br />
<img src="https://i.imgur.com/m7DKSyn.png" alt="68e9888e-bc35-4ba4-9f60-2c46a8fa81f5-image.png" class=" img-fluid img-markdown" /><br />
The above given grammar have only one parse tree so it is non-ambiguous grammar.<br />
Q No 02<br />
Solution:<br />
The given grammar is<br />
S  -&gt;  S + S | S / S | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19<br />
The draw parse trees for above given grammar:<br />
Parse Trees:<br />
<img src="https://i.imgur.com/hamteDh.png" alt="a4b787fc-27a6-401d-ab7a-5b97e4399d99-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">The above grammar has two different parse trees therefore the given grammar is ambiguous.</p>
<p dir="auto">THE END!</p>
]]></description><link>https://community.secnto.com//post/2158</link><guid isPermaLink="true">https://community.secnto.com//post/2158</guid><dc:creator><![CDATA[zareen]]></dc:creator><pubDate>Tue, 03 Dec 2019 14:25:46 GMT</pubDate></item></channel></rss>