Navigation

    Cyberian
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Pro Blog
    • Users
    • Groups
    • Unsolved
    • Solved
    Quiz 100% Result
    • CS606 GDB 1 Solution and Discussion

      laiba javed

      Re: CS606 GDB 1 Solution and Discussion

      Total Marks 5
      Starting Date Monday, February 15, 2021
      Closing Date Tuesday, February 16, 2021
      Status Open
      Question Title Intermediate Code Generation
      Question Description
      CS606 GDB Fall 2020

      Compilers are used to translate the source code in to machine code but there is an intermediate code is generated before the target machine code. Compilers can be developed to translate directly without generating machine code.

      Do you think intermediate code generation is extra and time consuming step while translating or it is necessary or beneficial in some way?

      Give your comments in favor or against it with proper reasons.

      Instructions:

      Read the following instructions carefully before sending your comments:

      GDB will have weightage of 5% of your total subject marks.
      Your discussion must be based on logical facts.
      You should post your comments on the Graded Discussion Board & not on the Regular MDB.
      Your comments should be relevant and to-the-point i.e. clear and concise (Maximum 4-5 lines answer using font style Times New Roman and Font Size 12).
      Books, websites and other reading material can be consulted but must be changed into your own wording before posting your comments. (Do not copy the material as it is.)
      No extra time will be given for discussion.

      CS606 - Compiler Construction
    • COMPILER CONSTRUCTION

      usman ahmed 0

      Assignment # 2
      COMPILER CONSTRUCTION

      a: Give the Syntax Directed Translation Scheme to translate the WHILE statement: choose either JAVA or C++ syntax for building grammar

      b: Now create THREE ADDRESS translation for the given piece of code:
      while (a > b)
      {
      if (c > d)
      c = c - d;
      else
      c = c + d;
      }

      CS606 - Compiler Construction
    • CS606 Assignment 3 Solution and Discussion

      zareen

      Re: CS606 Assignment 3 Solution and Discussion

      Assignment No. 3

      Semester: Spring 2020
      CS606 – Compiler Construction
      Total Marks: 20

      Due Date:
      July 27, 2020
      Instructions
      Please read the following instructions carefully before submitting assignment:
      It should be clear that your assignment will not get any credit if:

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

      Software (s) Used to develop Assignment

      MS Word MS Paint

      Assignment Submission Instructions
      Microsoft Word file is required to submit on LMS.

      Assignment Marks 20
      Question:

      S -> A S | y S | E
      A -> B | C w | v B
      B -> x C
      C -> z

      The symbols S, A, B and C are non-terminals with S as the start symbol while v, w, x, y, z are terminal symbols.

      Use the context-free grammar given above to answer the following questions.

      a) Give the FOLLOW and FIRST sets for each non-terminal symbol in above grammar
      b) Construct the parsing table for a non-recursive predictive parser for above grammar.

      Deadline:
      Your assignment must be uploaded on or before the due date. We shall not accept your solution through email after the due date.

      CS606 - Compiler Construction
    • CS606 Assignment 2 Solution and Discussion

      zareen

      Re: CS606 Assignment 2 Solution and Discussion

      Assignment No. 2

      Semester: Spring 2020
      CS606 – Compiler Construction
      Total Marks: 20

      Due Date:
      June 15, 2020
      Instructions
      Please read the following instructions carefully before submitting assignment:
      It should be clear that your assignment will not get any credit if:

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

      Software (s) Used to develop Assignment

      MS Word MS Paint

      Assignment Submission Instructions
      Microsoft Word file is required to submit on LMS.

      Assignment Marks 20
      Question:

      X -> aZ
      X -> c
      Y -> bX
      Z -> Ya
      Z -> XbY

      a) Find First sets for above grammar. (10 Marks)

      b) Find Follow sets for above grammar. (10 Marks)

      Deadline:
      Your assignment must be uploaded on or before the due date. We shall not accept your solution through email after the due date.

      CS606 - Compiler Construction
    • CS606 Assignment 1 Solution and Discussion

      zaasmi

      Re: CS606 Assignment 1 Solution and Discussion

      Assignment No. 1

      Semester: Spring 2020
      CS606 – Compiler Construction
      Total Marks: 20

      Due Date:
      June 01, 2020
      Instructions
      Please read the following instructions carefully before submitting assignment:
      It should be clear that your assignment will not get any credit if:

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

      Software (s) Used to develop Assignment

      MS Word MS Paint

      Assignment Submission Instructions
      Microsoft Word file is required to submit on LMS.

      Assignment Marks 20
      Task 1:

      For regular expression below, construct an NFA using Thompson’s construction. (10 Marks)

      R.E. = (y* xy* x)* y*

      Task 2:

      Use Subset Construction algorithm to find DFA for the NFA constructed in Task 1. (10 Marks)

      Deadline:
      Your assignment must be uploaded on or before the due date. We shall not accept your solution through email after the due date.

      CS606 - Compiler Construction
    • CS606 GDB 1 Solution and Discussion

      zareen

      Please share idea solution

      CS606 - Compiler Construction
    • CS606 Assignment 3 Solution and Discussion

      zareen

      CS606 – Compiler Construction
      Assignment # 03
      Fall 2019
      Total marks = 20

      Deadline Date
      22nd January, 2020

      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
      • LL(1) Table constructions
      • Follow Sets

      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 12+8=20 Marks

      Consider the grammar given below:

      S → XaXb
      S → Yb
      X → €
      Y → €

      Where € (epsilon) is empty string.

      a) Find First and Follow sets for above grammar. [12]
      b) Construct LL (1) parsing table. [8]

      Good Luck!

      CS606 - Compiler Construction
    • Umeed he kya? i mean count kar sakty kya app pa? kitna time lagy ga?

      Na VVeed Wajid

      Re: CS606 Assignment 3 Solution and Discussion

      CS606 - Compiler Construction
    • CS606 Assignment 2 Solution and Discussion

      zareen

      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!

      CS606 - Compiler Construction
    • CS606 Assignment 1 Solution and Discussion

      zareen

      CS606 – Compiler Construction
      Assignment # 01
      Fall 2019
      Total marks = 20

      Deadline Date
      14th Nov 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

      • Deterministic Finite Automaton (DFA)
      • Nondeterministic Finite Automaton (NFA)
      • Thompson’s Construction Algorithm

      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

      For regular expression below, construct an NFA using Thompson’s construction.
      R.E. = ((v + x)*y) + z

      Questions No 02 10 marks
      Use Subset Construction algorithm to find DFA for the NFA constructed in Task 1.

      Good Luck!

      CS606 - Compiler Construction

    CS606 GDB 1 Solution and Discussion

    CS606 - Compiler Construction
    compilers cs606 fall 2020 gdb 1 generating machine code solution
    3
    3
    111
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • laiba javed
      laiba javed last edited by

      Re: CS606 GDB 1 Solution and Discussion

      Total Marks 5
      Starting Date Monday, February 15, 2021
      Closing Date Tuesday, February 16, 2021
      Status Open
      Question Title Intermediate Code Generation
      Question Description
      CS606 GDB Fall 2020

      Compilers are used to translate the source code in to machine code but there is an intermediate code is generated before the target machine code. Compilers can be developed to translate directly without generating machine code.

      Do you think intermediate code generation is extra and time consuming step while translating or it is necessary or beneficial in some way?

      Give your comments in favor or against it with proper reasons.

      Instructions:

      Read the following instructions carefully before sending your comments:

      GDB will have weightage of 5% of your total subject marks.
      Your discussion must be based on logical facts.
      You should post your comments on the Graded Discussion Board & not on the Regular MDB.
      Your comments should be relevant and to-the-point i.e. clear and concise (Maximum 4-5 lines answer using font style Times New Roman and Font Size 12).
      Books, websites and other reading material can be consulted but must be changed into your own wording before posting your comments. (Do not copy the material as it is.)
      No extra time will be given for discussion.

      O Uzma noor 2 Replies Last reply Reply Quote 0
      • Uzma noor
        Uzma noor @laiba javed last edited by

        @laiba-javed said in CS606 GDB 1 Solution and Discussion:

        Do you think intermediate code generation is extra and time consuming step while translating or it is necessary or beneficial in some way?

        Stack Allocation
        We now need to access the ARs from the stack. The key distinction is that the location of the current AR is not known at compile time. Instead a pointer to the stack must be maintained dynamically.

        We dedicate a register, call it SP, for this purpose. In this chapter we let SP point to the bottom of the current AR, that is the entire AR is above the SP. Since we are not supporting varargs, there is no advantage to having SP point to the middle of the AR as in the previous chapter.

        The main procedure (or the run-time library code called before any user-written procedure) must initialize SP with
        LD SP, #stackStart
        where stackStart is a known-at-compile-time constant.

        The caller increments SP (which now points to the beginning of its AR) to point to the beginning of the callee’s AR. This requires an increment by the size of the caller’s AR, which of course the caller knows.

        Is this size a compile-time constant?

        The book treats it as a constant. The only part that is not known at compile time is the size of the dynamic arrays. Strictly speaking this is not part of the AR, but it must be skipped over since the callee’s AR starts after the caller’s dynamic arrays.

        Perhaps for simplicity we are assuming that there are no dynamic arrays being stored on the stack. If there are arrays, their size must be included in some way.

        1 Reply Last reply Reply Quote 0
        • O
          Ozair @laiba javed last edited by

          @zaasmi said in CS606 GDB 1 Solution and Discussion:

          ntermediate code generation

          As expected the input to the code generator is the output of the intermediate code generator. We assume that all syntactic and semantic error checks have been done by the front end. Also, all needed type conversions are already done and any type errors have been detected.

          We are using three address instructions for our intermediate language. These instructions have several representations, quads, triples, indirect triples, etc. In this chapter I will tend to use the term quad (for brevity) when I should really say three-address instruction, since the representation doesn’t matter.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post

          50% Off on Your FEE Join US!

          Quiz 100% Result If you want to know how you can join us and get 50% Discout on your FEE ask Cyberian in Chat Room! Quiz 100% Result Quiz 100% Result
          solution1241 discussion1194 fall 2019813 assignment 1425 assignment 2295 spring 2020265 gdb 1246 assignment 382 crw10174 spring 201955
          | |
          Copyright © 2021 Cyberian Inc. Pakistan | Contributors
          Live Chat