Fall 2024 - CS606 - 2
Fall 2024 - CS606 - 2
Total Marks: 20
Assignment No. 02
Due Date: Jan 1, 2025
Semester: Fall 2024
Please read the following instructions carefully and delete the first page from your solution file before
submitting assignment:
Uploading Instructions:
o You are supposed to consult recommended book/s to clarify your concepts as handouts are not sufficient.
o The assignment file must be an MS Word file. Any other software/tool is not allowed.
o The required file format is .doc or .docx. Any other format like scan images, txt, pdf, png or jpeg etc. will
not be accepted.
o Place all solutions in a single MS Word file along with your own Student Id at top.
o Submit the MS Word file at VULMS within the due date.
Note:
o 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.
o It is recommended to upload solution file at least one day before its closing date.
o Do not put any query on MDB regarding this assignment, if you have any query then email at
[email protected]
1
CS606 – Compiler Construction
Total Marks: 20
Assignment No. 02
Due Date: Jan 1, 2025
Semester: Fall 2024
Question Statement:
Imagine you're a software developer working on an exciting
challenge: designing a compiler for a new programming language
called EcoLang. This language is specifically created for an
environmentally friendly IoT device that has limited memory
and processing power. Because of these constraints, the device
can only work with three-address code for computations. Your
mission is to generate optimized intermediate code for EcoLang
that uses as few instructions as possible while ensuring
correctness.
Features to Implement
1. Arithmetic Expression Simplification:
EcoLang supports complex, nested arithmetic expressions like:
((a + b) * c) - (d / e).
Your task is to break it down and write optimized three-address
code for such expressions.
2. Conditional Statements:
The language includes conditional logic, such as:
if (a > b) then x = y + z else x = y - z.
You'll write intermediate code that efficiently handles such
conditions.
Your Tasks
Based on the scenario, complete the following:
2
CS606 – Compiler Construction
Total Marks: 20
Assignment No. 02
Due Date: Jan 1, 2025
Semester: Fall 2024
Good Luck