0% found this document useful (0 votes)
68 views2 pages

CPTT CSE 3739 Assignment-II

This document is an assignment for a B.Tech course in Compilers at ITER, SIKSHA 'O' ANUSANDHAN, due on May 17, 2025. It includes questions on constructing LR(1) and LALR(1) parsing tables, evaluating expressions using syntax-directed translation, and generating three-address code. The assignment aims to assess students' understanding of programming languages, compiler structure, and various parsing and translation techniques.

Uploaded by

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

CPTT CSE 3739 Assignment-II

This document is an assignment for a B.Tech course in Compilers at ITER, SIKSHA 'O' ANUSANDHAN, due on May 17, 2025. It includes questions on constructing LR(1) and LALR(1) parsing tables, evaluating expressions using syntax-directed translation, and generating three-address code. The assignment aims to assess students' understanding of programming languages, compiler structure, and various parsing and translation techniques.

Uploaded by

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

ITER, SIKSHA ‘O’ ANUSANDHAN Assignment

(Deemed to be University)

Branch CSE/CSIT Programme B.Tech


Course Name Compilers : Principles, Techniques and Tools Semester 6th
Course Code CSE 3739 Academic Year 2024-25
ASSIGNMENT - II
Submission due date: 17/05/2025
Learning Level L1: Remembering L3: Applying L5: Evaluating
(LL) L2: Understanding L4: Analysing L6: Creating
Q’s Questions COs LL
Consider the grammar
SaAd|bBd|aBe|bAe
Ac
Bc
1 CO3 L6
i) Create the LR(1) canonical sets of items.
ii) Construct the CLR(1) parsing table for the grammar.
iii) Construct the LALR(1) parsing table for the grammar. Is the grammar
LALR(1) ?Justify.
Consider the following grammar and their syntax Directed Translation (SDT) rules.
Productions Sementic Rules
S→S*A {S.val = S.val × A.val}
S→A {S.val = A.val}
A→A+B {A.val = A.val - B.val}
2 CO4 L6
B → (S) {B.val = 2}
A→B {A.val = B.val}
B → id {B.val = id.lexval}

Construct the annotated parse tree and evaluate the value of the expression 4*6+3*7
A shift reduce parser carries out the actions specified within braces immediately after
reducing with the corresponding rule of grammar.

SaaW {print ‘1’ }


3 Sb {print ‘2’ } CO4 L6
WSc {print ‘3’ }

Construct the annotated parse tree and find the translation of aaaabcc using the syntax
directed translation scheme described by the above rules?
Consider the expression
4 a + a * (b-c) + (b-c) * d CO5 L3,L4
Generate the three-address code (TAC) for the given expression.
Represent the three-address code that is generated in Q.4, using the following
intermediate code formats:
i) Quadruples
5 CO5 L4,L6
ii) Triples
iii) Indirect Triples

By the end of the course, through lectures, readings, home works, assignments,
and exams, students will be able to:
Understand the overview of programming languages, language processors and
CO1
the structure of a compiler
Course Outcomes Acquire knowledge in theory of computation and their role in designing
CO2
different types of tokens generated by lexical analyzer
Understand the role of Parser(s) (LL, SLR, CLR and LALR) and its types i.e.
CO3
Top-down and Bottom-up parsers.
CO4 Apply and evaluate syntax directed translation schemes, synthesized
attributes, inherited attributes, and different techniques for symbol table
organization
Analyze the generation of various intermediate codes and the process of their
CO5
optimization.
Understand the target machine’s run time environment, and its instruction set
CO6
for code generation and techniques used for code optimization

You might also like