0% found this document useful (0 votes)
158 views

CS 6002 Compiler Design

This document describes the contents of the Compiler Design course for the 6th semester of a B. Tech in Computer Science and Engineering program. The course introduces the basic techniques of compiler construction, including lexical analysis, syntax analysis, syntax-directed translation, code generation, and optimization. It covers topics such as finite state machines, context-free grammars, parsing techniques, syntax trees, intermediate code representations, symbol tables, code optimization, and error handling. Students will learn to implement components of a compiler using tools like Lex and Yacc. The course aims to teach students how to construct a compiler to translate a high-level language into machine code.

Uploaded by

vivek
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)
158 views

CS 6002 Compiler Design

This document describes the contents of the Compiler Design course for the 6th semester of a B. Tech in Computer Science and Engineering program. The course introduces the basic techniques of compiler construction, including lexical analysis, syntax analysis, syntax-directed translation, code generation, and optimization. It covers topics such as finite state machines, context-free grammars, parsing techniques, syntax trees, intermediate code representations, symbol tables, code optimization, and error handling. Students will learn to implement components of a compiler using tools like Lex and Yacc. The course aims to teach students how to construct a compiler to translate a high-level language into machine code.

Uploaded by

vivek
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

B. Tech. VI Semester COMPUTER SCIENCE & Engg.

COURSE CONTENTS (UEC SCHEME)


CS-6002 Compiler Design L T P C Max. Marks Min. Marks
Duration 5 Hours 2 1 2 4 70 22

Course Description:
The course is intended to teach the students the basic techniques that underlie the practice of Compiler
Construction. The course will introduce the theory and tools that can be standardly employed in order to
perform syntax-directed translation of a high-level programming language into an executable code. It also
focuses on various designs of Compiler and structuring and optimizing various phases of a Compiler

Course Objective
 Understand the basic concepts and application of Compiler Design.
 To learn how to construct compiler to translate High Level Languages to Machine Language.
 To learn different phases of compiler and how to implement them.
 To learn efficient machine Language Code Generation using the techniques of Optimization.

Syllabus
Unit I:
Introduction of compiler & Lexical Analysis: Phases and passes, Bootstrapping, Finite state machines
and regular expressions and their applications to lexical analysis, implementation of lexical analyzers,
LEecification of programming languages: Context free grammars, derivation and parse trees, capabilities of
CFGX-compiler, Formal grammars and their application to syntax analysis, ambiguity, The syntactic sp

Unit-II:
Syntax Analysis:Parsers, Shift reduce parsing, operator precedence parsing, top down parsing, predictive
parsers Automatic Construction of efficient Parsers: LR parsers, the canonical Collection of LR(0) items,
constructing SLR parsing tables, constructing Canonical LR parsing tables, Constructing LALR parsing
tables, using ambiguous grammars, an automatic parser generator, YACC tool.

Unit-III:
Syntax-directed Translation: Syntax-directed Translation schemes, Intermediate code, postfix notation,
Parse trees & syntax trees, three address code, quadruple & triples, Translation of simple statements and
control flow statements, Type checking, Type conversions, Equivalence of type expressions, Overloading
of functions and operations.

Unit-IV:
Run Time Environment and Error Recovery: Source Language Issues, Storage Organization, Storage-
Allocation Strategies, and Access to Non local Names, Parameter Passing, Symbol Tables, and Language
Facilities for Dynamic Storage Allocation, Dynamic Storage Allocation Techniques, Error Detection &
Recovery, Ad-Hoc and Systematic Methods.

Unit V:
Code Generation and Code Optimization: Issues in the Design of a Code Generator, The Target
Machine, Run-Time Storage Management, Basic Blocks and Flow Graphs, Next-Use Information, A
Simple Code Generator, Register Allocation and Assignment, The DAG Representation of Basic Blocks,
Peephole Optimization, Generating Code from DAGs, Dynamic Programming Code-Generation
Algorithm, Global Data Flow Analysis, A Few Selected Optimizations like Command Sub Expression
Removal, Loop Invariant Code Motion, Strength Reduction etc.

Course Outcomes:
 Understands compiler and various phases in compilation
 Understands Lexical Analysis and implement it using LEX tool.
 Understands LL, LR, and SLR parsing techniques.
 Implement parsing using YACC tool.
 Understands Syntax Directed Translation, Symbol Tables and their applications.

References Books:
1. A. V. Aho, R. Sethi, and J. D. Ullman. Compilers: Principles, Techniques and Tools, Pearson
Edu.
2. Raghavan, Compiler Design, TMH Pub.
3. Louden. Compiler Construction: Principles and Practice, Cengage Learning
4. A.C. Holub. Compiler Design in C, Prentice-Hall Inc., 1993.
5. Mak, writing compiler & Interpreters, Willey Pub.

List of Experiments:
1. Develop a lexical analyzer to recognize a few patterns in C. (Ex. identifiers, constants, comments,
operators etc.). Create a symbol table, while recognizing identifiers
2. Write a C program to identify whether a given line is a comment or not.
3. Write a Lex program to count number of vowels and consonants in a given input string.
4. Write a Lex program to printout all HTML tags in file
5. Write a Lex program to count the number of comment lines in a given C program. Also eliminate
them and copy that program into separate file.
6. Write a C program for constructing of LL (1) parsing.
7. Write a C program for constructing recursive descent parsing.
8. Write a C program to implement LALR parsing.
9. Write a C program to implement operator precedence parsing.
10. Generate YACC specification for a few syntactic categories

You might also like