We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More


Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

Assignment No 3 of CS606 is uploaded on VULMS. Deadline of assignment is February 06, 2017 while February 07, 2017 is the bonus day

Assignment No.  3
Semester: FALL 2016

CS606 – Compiler Construction

 

Total Marks: 20

 

Due Date:

February 06, 2017

Instructions

Please read the following instructions carefully before submitting assignment:

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

 

  • Assignment is submitted after due date.
  • Submitted assignment does not open or file is corrupt.
  • Assignment is copied (From internet/ to from students).

 

Software (s) Used to develop Assignment

-          MS Word

-          MS Paint

Assignment Submission Instructions

MS-Word Document is required to submit. All other formats are marked as zero.

 

Assignment

 

 

Question No 01: [Marks = 5]

 

Give context-free grammars that generate the following language. In all parts the alphabet ∑ is {a,b}.

{w| w starts and ends with the different symbols}

     

Question No 02: [Marks = 10]

 

Considering the following productions of a CFG:

<goal>            à   <expression>

<expression>  à   <term> / <expression> - <term>

<term>           à   <factor> / <term> + <factor>

<factor>         à   a / b / c

Construct a parse tree for the string “c – b + a + b”.

 

Question No 03: [Marks = 5]

 

If we give the input “b = a + c” to the scanner, the scanner maps the character stream into “words” that are the basic unit of syntax. Write the pairs of words in <token type, word> format from the given input.

 

 

Deadline:

Your assignment must be uploaded on VULMS on February 06, 2017. While February 07, 2017 will be a bonus day for assignment submission.

 

+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?


See Your Saved Posts Timeline

Views: 1329

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Attachments:

Replies to This Discussion

is it correct ?

Q no 1 : Give context-free grammars that generate the following language. In all parts the alphabet ∑ is {a,b}.
{w| w starts and ends with the different symbols}



L = {w|w starts and ends with the same symbol}
S0 → 0S10|1S11|ε
S1 → 0S1|1S1|ε

Assignment

 

 

Question No 01: [Marks = 5]

 

Give context-free grammars that generate the following language. In all parts the alphabet ∑ is {a,b}.

{w| w starts and ends with the different symbols}

     

Question No 02: [Marks = 10]

 

Considering the following productions of a CFG:

<goal>                <expression>

<expression>       <term> / <expression> - <term>

<term>                <factor> / <term> + <factor>

<factor>              a / b / c

Construct a parse tree for the string “c – b + a + b”.

Solution:

<goal>  <expression>

             <expression> - <term>

             <expression> - <term> + <factor>

             <expression> - <term> + <factor> + <factor>

             <expression> - <factor> + <factor> +        b

             <expression> -  <factor> +    a         +      b

             <term>          -        b       +     a       +    b

             <factor>        -        b       +     a       +    b

                   c              -        b       +     a       +    b

Construct a parse tree for the string “c – b + a + b”.

 

                                                            

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Question No 03: [Marks = 5]

 

If we give the input “b = a + c” to the scanner, the scanner maps the character stream into “words” that are the basic unit of syntax. Write the pairs of words in <token type, word> format from the given input.

Solution:

the input

b = a + c

 becomes

<id,b>

<assign,=

> <id,a>

<op,+>

<id,c>

 

 

♥♣Muhammad Touseef♣♥

 

cs606 assignment solution

Attachments:

Question No 01: [Marks = 5]

Give context-free grammars that generate the following language. In all parts the alphabet ∑ is {a,b}.
{w| w starts and ends with the different symbols}


Question No 02: [Marks = 10]

Considering the following productions of a CFG:
<goal>à <expression>
<expression>à <term> / <expression> - <term>
<term>à <factor> / <term> + <factor>
<factor>à a / b / c

Construct a parse tree for the string “c – b + a + b”.

Solution:

<goal> à <expression>
à <expression> - <term>
à <expression> - <term> + <factor>
à<expression> - <term> + <factor> + <factor>
à<expression> - <factor> + <factor> + b
à<expression>- <factor> + a + b
à<term> - b + a + b
à<factor> - b + a + b
àc - b + a + b
Construct a parse tree for the string “c – b + a + b”.

CS606

Attachments:

RSS

© 2020   Created by +M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service

.