Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
16 views4 pages

Assignment Questions - Compiler Design - Computer Sicence

The Compiler Design Assignment requires students to work in groups of four while ensuring individual contributions and prohibiting plagiarism. The assignment consists of 14 questions covering topics such as Syntax Directed Translation, Type Checking, Intermediate Languages, and Runtime Environments, with a total mark of 40%. Completed assignments must be submitted by August 31, 2024, with late submissions potentially not accepted.

Uploaded by

biniyam.tiktok
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views4 pages

Assignment Questions - Compiler Design - Computer Sicence

The Compiler Design Assignment requires students to work in groups of four while ensuring individual contributions and prohibiting plagiarism. The assignment consists of 14 questions covering topics such as Syntax Directed Translation, Type Checking, Intermediate Languages, and Runtime Environments, with a total mark of 40%. Completed assignments must be submitted by August 31, 2024, with late submissions potentially not accepted.

Uploaded by

biniyam.tiktok
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Compiler Design Assignment

Instructions:
1. Group Work:
o Form groups of 4 students.
o Collaborate with your group members to complete the assignment.
2. Individual Effort Required:
o All work must be your own.
o Plagiarism, cheating, and the use of AI tools are strictly prohibited.
o Each group member must contribute equally to the assignment.
3. Assignment Questions:
o Address each question thoroughly.
o Ensure that your answers are clear and concise.
o Total Mark: 40%
4. Submission:
o Submit your completed assignment by the deadline.
o Late submissions may not be accepted.
o Deadline Date: August 31, 2024 (After 3 Weeks)

1
Compiler Design Assignment

Assignment Questions: Syntax Directed Translation


Question #1: Syntax Directed Definitions (SDD)
 Design an SDD:
o Choose a basic language feature, such as variable declarations with type checking or
a simple arithmetic expression. Develop a Syntax Directed Definition (SDD) for this
feature, including the grammar and key attribute rules.
Question #2: Evaluation Order for SDD
 Determine Evaluation Order:
o For a given grammar with both synthesized and inherited attributes, such as an
expression grammar that supports addition and multiplication, explain how you
would determine the correct evaluation order of attributes. Illustrate with an
example.
Question #3: Construction of Syntax Trees
 Build a Syntax Tree:
o Design a syntax tree for a simple language construct, such as a conditional statement
(if-else) or a basic loop (while). Explain how the syntax tree would be constructed
during parsing and its role in the compilation process.

Assignment Questions: Type Checking


Question #4: Rules of Type Checking
 Basic Exploration:
o Briefly explain the purpose of type checking in programming languages. Provide
an example of how a simple type error is caught during compilation or
interpretation.
Question #5: Type Conversions
 Understanding Type Conversions:
o What are type conversions in programming languages? Give an example of both
implicit and explicit type conversion in any programming language.

2
Compiler Design Assignment

Question #6: Type Checking and Conversion in Practice


 Application Example:
o Describe a situation in programming where type checking and type conversion
interact. How does the language handle this, and what might go wrong if type
checking isn't strict?

Assignment Questions: Intermediate Languages


Question #7: Three Address Code Rules
 Explore Three Address Code (TAC):
o What are the basic rules for generating Three Address Code (TAC) in compiler
design? Provide an example of converting a simple arithmetic expression into
TAC, and explain how these rules ensure that the code is optimized for execution.
Question #8: Quadruples and Flow Control Statements
 Understanding Quadruples and Control Flow:
o Describe what quadruples are in the context of intermediate code
representation. How are flow control statements (e.g., if-else, loops) represented
using quadruples? Provide an example to illustrate your explanation.
Question #9: Declarations and Back Patching
 Linking Declarations and Back Patching:
o Explain the role of declarations in a program’s intermediate representation. What
is back patching, and how does it relate to handling declarations, particularly in
the context of control flow statements? Give an example of how back patching is
applied in the process of handling forward jumps.
Question #10: Declarations in Procedures and Procedure Calls
 Procedural Declarations and Calls:
o How are declarations within procedures different from global declarations in
intermediate code? Discuss how procedure calls are handled in the intermediate
representation, including the management of activation records or stack frames.
Use a simple example to illustrate your points.

Assignment Questions: Runtime Environments and Code Generation

3
Compiler Design Assignment

Question #11: Symbol Table and Hash Table


 Symbol Table Basics:
o a) What is the purpose of a symbol table in a compiler?
o b) How does a hash table improve the efficiency of a symbol table? Briefly
explain with an example.
Question #12: Representing Scope Information
 Scope Management:
o a) How is scope information represented in a language with nested functions or
blocks?
o b) Provide a simple example of how scope resolution is handled at runtime.
Question #13: Simple Code Generation and Register Allocation
 Code Generation and Register Usage:
o a) What are the basic steps in generating code from intermediate
representation?
o b) How does register allocation help optimize generated code? Give a brief
example.
Question #14: DAG Representation and Peephole Optimization
 Optimizations with DAG and Peephole Techniques:
o a) What is a Directed Acyclic Graph (DAG) used for in code optimization? Provide
a basic example.
o b) What are peephole optimizations? Describe a simple peephole optimization
technique.

You might also like