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

Compiler Design_LabFile

The document outlines a Compiler Design Lab course for Bachelor of Technology students in Computer Science & Engineering at the University of Petroleum & Energy Studies. It includes a table of contents detailing various experiments focused on lexical and syntax analysis using tools like Lex and Yacc, along with programming assignments in C. Each experiment aims to develop specific skills related to compiler design, such as parsing and grammar simulation.

Uploaded by

tandonmitul277
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Compiler Design_LabFile

The document outlines a Compiler Design Lab course for Bachelor of Technology students in Computer Science & Engineering at the University of Petroleum & Energy Studies. It includes a table of contents detailing various experiments focused on lexical and syntax analysis using tools like Lex and Yacc, along with programming assignments in C. Each experiment aims to develop specific skills related to compiler design, such as parsing and grammar simulation.

Uploaded by

tandonmitul277
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 30

Compiler Design Lab

BACHELOR OF TECHNOLOGY
in
COMPUTER SCIENCE & ENGINEERING

Name of student
Mitul Tandon
Sap ID
500105734

SCHOOL OF COMPUTER SCIENCE


UNIVERSITY OF PETROLEUM & ENERGY STUDIES
Table of Contents
Experiment Title Page Remark
2 Introductory 3-6
Problems using Lex
Tools
3 Lexical Analysis 7-8
through Lexx Tools
4 Syntax Analysis via 9-11
Yacc Tool
5 Simulation of FIRST 12-15
& FOLLOW of a
Grammar
6 WAP to construct
LL(1) parser for an
expression in C
7 WAP to implement a
Predictive Parser for
a given language in
C
8 WAP to calculate
Leading for all the
Non-Terminals in C
9 WAP to
calculate Trailing for
all the NonTerminals
in C
10 Development of an
Operator
Precedence Parser
11 WAP to implement
Shift-Reduce Parser
in C
Experiment – 2

Aim: Introductory Problems using Lex Tools

1. WAP to count number of vowels and consonants in a given string.


2. WAP to count the number of characters, words, spaces, and end of lines in a
given input file.
3. WAP to count number of comment lines in a given C program.
Experiment – 3

Aim: Lexical Analysis through Lexx Tools.

1. WAP to count number of ‘scanf’ and ‘printf’ statements in a C program.


Replace them with ‘read’ and ‘write’ statements respectively.
2. WAP to recognize a valid arithmetic expression and identify the identifiers and
operators present. Print them separately.
Experiment – 4

Aim: Syntax Analysis via Yacc Tool.

1. WAP to test the validity of a simple expression involving operators- +, -, *, and


/.
2. WAP to evaluate an arithmetic expression involving operators- +, -, *, and /.
Experiment – 5

Aim: Simulation of FIRST & FOLLOW of a Grammar.


1. WAP to simulate FIRST and FOLLOW of a grammar in C
Experiment – 6

WAP to construct LL(1) parser for an expression in C


Experiment – 8
WAP to calculate Leading for all the Non-Terminals in C

Experiment – 9
WAP to calculate Trailing for all the Non Terminals in C

Experiment – 10
WAP to implement an Operator Precedence Parser for a given language in C
Output:
Experiment – 11

WAP to implement Shift-Reduce Parser in C


Output:

You might also like