0% found this document useful (0 votes)
10 views8 pages

CD Manual Preface

The document is a laboratory manual for the Compiler Design course (COMP702) aimed at B.E. Semester 7 Computer Engineering students. It outlines the vision and mission of the Directorate of Technical Education and the institute, along with program outcomes, specific outcomes, and educational objectives related to computer engineering. The manual provides practical exercises, guidelines for faculty and students, and safety instructions to facilitate hands-on learning in compiler design, including the implementation of various compiler components using C and Lex.

Uploaded by

Neeraj Nair
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)
10 views8 pages

CD Manual Preface

The document is a laboratory manual for the Compiler Design course (COMP702) aimed at B.E. Semester 7 Computer Engineering students. It outlines the vision and mission of the Directorate of Technical Education and the institute, along with program outcomes, specific outcomes, and educational objectives related to computer engineering. The manual provides practical exercises, guidelines for faculty and students, and safety instructions to facilitate hands-on learning in compiler design, including the implementation of various compiler components using C and Lex.

Uploaded by

Neeraj Nair
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/ 8

COMP702 Compiler Design(3170701) 210180107048

A Laboratory Manual for

Compiler Design
(3170701)

B.E. Semester 7
(Computer Engineering)

Directorate of Technical Education Gandhinagar, Gujarat

GOVERNMENT ENGINEERING COLLEGE DAHOD


Affiliated to GUJARAT TECHNOLOGICAL UNIVERSITY

COMPUTER ENGINEERING DEPARTMENT


COMP702 Compiler Design(3170701) 210180107048

DTE’s Vision

 To provide globally competitive technical education


 Remove geographical imbalances and inconsistencies
 Develop student friendly resources with a special focus on girls’ education and
support to weaker sections
 Develop programs relevant to industry and create a vibrant pool of technical professionals

Institute’s Vision

To be a value based engineering institute to disseminate globally acceptable education and to


nurture research, innovation and entrepreneurship.

Institute’s Mission

 To provide quality education in engineering disciplines through creative balance of


academic and extra-curricular activities.
 To provide learning environment for innovation and entrepreneurship.
 To disseminate ethical values, social values and sensitivity towards environmental issues.

Department’s Vision

 To be a distinguished department that provides an environment conducive to


learning, innovation and research while nurturing an inclusive and all-round
development of its stakeholders.

Department’s Mission

 To prepare computer engineers capable of implementing professionally valued solutions.


 To imbibe aspects of lifelong learning, adapting technological change and
addressing needs of society by keeping abreast of advancements in engineering
and technology.
 To adhere to core ethical values, social values and sensitivity towards environment.
COMP702 Compiler Design(3170701) 210180107048

Programme Outcomes (POs)

1. Engineering knowledge: Apply the knowledge of mathematics, science,engineering


fundamentals, and an engineering specialization to the solution of complex engineering
problems.
2. Problem analysis: Identify, formulate, review research literature, and analyzecomplex
engineering problems reaching substantiated conclusions using first principles of
mathematics, natural sciences, and engineering sciences.
3. Design/development of solutions: Design solutions for complex engineeringproblems
and design system components or processes that meet the specified needs with
appropriate consideration for the public health and safety, and the cultural, societal, and
environmental considerations.
4. Conduct investigations of complex problems: Use research-based knowledgeand
research methods including design of experiments, analysis and interpretation of data, and
synthesis of the information to provide valid conclusions.
5. Modern tool usage: Create, select, and apply appropriate techniques,resources, and
modern engineering and IT tools including prediction and modeling to complex
engineering activities with an understanding of the limitations.
6. The engineer and society: Apply reasoning informed by the contextualknowledge to
assess societal, health, safety, legal and cultural issues and the consequent responsibilities
relevant to the professional engineering practice.
7. Environment and sustainability: Understand the impact of the professionalengineering
solutions in societal and environmental contexts, and demonstrate the knowledge of, and
need for sustainable development.
8. Ethics: Apply ethical principles and commit to professional ethics andresponsibilities and
norms of the engineering practice.
9. Individual and team work: Function effectively as an individual, and as amember or
leader in diverse teams, and in multidisciplinary settings.
10. Communication: Communicate effectively on complex engineering activitieswith the
engineering community and with society at large, such as, being able to comprehend and
write effective reports and design documentation, make effective presentations, and give
and receive clear instructions.
11. Project management and finance: Demonstrate knowledge and understandingof the
engineering and management principles and apply these to one’s own work, as a member
and leader in a team, to manage projects and in multidisciplinary environments.
12. Life-long learning: Recognize the need for, and have the preparation and abilityto
engage in independent and life-long learning in the broadest context of
technologicalchange.

Program Specific Outcomes (PSOs)


 Apply standard software engineering practices and strategies in real time software
project development using open source programming environment or commercial
environment to deliver quality product for the organizations success.
 Design, Develop or Maintain Computing facilities related to data management,
COMP702 Compiler Design(3170701) 210180107048

networking, computation, storage and security.

Program Educational Objectives (PEOs)


 Contribute towards analysis, design and development of solutions requiring
expertise in computer engineering domain.
 Pursue higher education and research or to be a entrepreneur to achieve diversified
professional goals.
 Practice engineering with professional and ethical conduct.
 Apply engineering principals to economically viable, social and eco-friendly solutions.
Preface

Compiler Design is an essential subject for computer science and engineering students. It deals
with the theory and practice of developing a program that can translate source code written in one
programming language into another language. The main objective of this subject is to teach
students how to design and implement a compiler, which is a complex software system that
converts high-level language code into machine code that can be executed on a computer. The
design of compilers is an essential aspect of computer science, as it helps in bridging the gap
between human-readable code and machine-executable code.

This lab manual is designed to help students understand the concepts of compiler design and
develop hands-on skills in building a compiler. The manual provides step-by-step instructions for
implementing a simple compiler using C and other applicable programming language, covering
all the essential components such as lexical analyzer, parser, symbol table, intermediate code
generator, and code optimizer.

The manual is divided into several sections, each focusing on a specific aspect of compiler design.
The first section provides an introduction to finite automata, phases of compiler and covering the
basic concepts of lexical analysis. The subsequent sections cover parsing, code generation, and
study of Learning Basic Block Scheduling. Each section includes detailed instructions for
completing the lab exercises and programming assignments, along with examples and code
snippets.

The lab manual also includes a set of challenging programming assignments and quizzes that will
help students test their understanding of the subject matter. Additionally, the manual provides a
list of recommended books and online resources for further study.
This manual is intended for students studying Compiler Design and related courses. It is also
useful for software developers and engineers who want to gain a deeper understanding of
compiler design and implementation. We hope that this manual will be a valuable resource for
students and instructors alike and will contribute to the learning and understanding of compiler
design.
COMP702 Compiler Design(3170701) 210180107048

Practical – Course Outcome matrix

Course Outcomes (COs):


CO-1 Understand the basic concepts; ability to apply automata theory and knowledge on formal
languages.
CO-2 Ability to identify and select suitable parsing strategies for a compiler for
various cases. Knowledge in alternative methods (top-down or bottom-up, etc).
CO-3 Understand backend of compiler: intermediate code, Code optimization
Techniques and Error Recovery mechanisms
CO-4 Understand issues of run time environments and scheduling for instruction level
parallelism.
Sr.
Objective(s) of Experiment CO1 CO2 CO3 CO4 C
No. O
5
Design a lexical analyzer for given language and the √
lexical analyzer should ignore redundant spaces,
1. tabs and new lines. It should also ignore comments. √
Although the syntax specification states that
identifiers can be arbitrarily long, you may restrict
the length to some reasonable value. Simulate the
same in C language
Write a C program to identify whether a √
2. given line is a comment or not √

3. Write a C program to test whether a given √


identifier is valid or not.
4. Write a C program to simulate lexical analyzer for √
validating operators
Write a program to remove left recursion from
5. grammar. √

Write a program to remove left factoring from


6. grammar √
Write a program to find FIRST and
7. FOLLOW set of grammar √

8. Write a program to find whether a grammar is LL(1) √


or not
Write a program to implement operator precedence
9. parsing √
Write a program to implement SLR parsing
10. √
Implement following programs using Lex.
11.
a.) Create a Lexer to take input from text file and
COMP702 Compiler Design(3170701) 210180107048

count no of characters, no. of lines & no. of words. √


b.) Write a Lex program to count number of vowels
and consonants in a given input string.
Implement following programs using Lex.
12. a.) Write a Lex program to print out all numbers from the
given file. √
b.) Write a Lex program to printout all HTML tags in
file.
c.) Write a Lex program which adds line numbers to the
given file and display the same onto the standard
output.
Guidelines for Faculty members

1. Teacher should provide the guideline with demonstration of practical to the


students with all features.
2. Teacher shall explain basic concepts/theory related to the experiment to the students
before starting of each practical
3. Involve all the students in performance of each experiment.
4. Teacher is expected to share the skills and competencies to be developed in the
students and ensure that the respective skills and competencies are developed in
the students after the completion of the experimentation.
5. Teachers should give opportunity to students for hands-on experience after the
demonstration.
6. Teacher may provide additional knowledge and skills to the students even
though not covered in the manual but are expected from the students by
concerned industry.
7. Give practical assignment and assess the performance of students based on task
assigned to check whether it is as per the instructions or not.
8. Teacher is expected to refer complete curriculum of the course and follow the
guidelines for implementation.

Instructions for Students

1. Students are expected to carefully listen to all the theory classes delivered by the
faculty members and understand the COs, content of the course, teaching and
examination scheme, skill set to be developed etc.
2. Students will have to perform experiments as per practical list given.
3. Students have to show output of each program in their practical file.
4. Students are instructed to submit practical list as per given sample list shown on next page.
5. Student should develop a habit of submitting the experimentation work as per the
schedule and s/he should be well prepared for the same

Common Safety Instructions


Students are expected to
1) switch on the PC carefully (not to use wet hands)
2) shutdown the PC properly at the end of your Lab
3) carefully handle the peripherals (Mouse, Keyboard, Network cable etc).
4) use Laptop in lab after getting permission from Teacher
COMP702 Compiler Design(3170701) 210180107048

Index
(Progressive Assessment Sheet)

Sr. Practical Title Date Page No. Sign


No.
1. Design a lexical analyzer for given language and the 1
lexical analyzer should ignore redundant spaces, tabs
and new lines. It should also ignore comments.
Although the syntax specification states that identifiers
can be arbitrarily long, you may restrict the length to 15/07/2024
some reasonable value. Simulate the same in C
language

2. Write a C program to identify whether a given line is a 22/07/2024 3


comment or not
3. Write a C program to test whether a given identifier is 22/07/2024 5
valid or not.
4. Write a C program to simulate lexical analyzer for 05/08/2024 7
validating operators
5. Write a program to remove left recursion from 12/08/2024 9
grammar.
6. Write a program to remove left factoring from grammar 02/09/2024 10

7. Write a program to find FIRST and FOLLOW set of 09/09/2024 12


grammar
8. Write a program to find whether a grammar is LL(1) or 23/09/2024 17
not
9. Write a program to implement operator precedence 23/09/2024 22
parsing
10. Write a program to implement SLR parsing 30/09/2024 25
COMP702 Compiler Design(3170701) 210180107048

11. Implement following programs using Lex.


a.) Create a Lexer to take input from text file and count no
of characters, no. of lines & no. of words. 07/10/2024 31
b.) Write a Lex program to count number of vowels and
consonants in a given input string.

12. Implement following programs using Lex.


a.) Write a Lex program to print out all numbers from the
given file. 14/10/24 34
b.) Write a Lex program to printout all HTML tags in file.
c.) Write a Lex program which adds line numbers to the
given file and display the same onto the standard output.

You might also like