Lab Record
of
COMPILER
DESIGN
(CS 304)
Submitted to: Submitted by:
Ms. Aditi Sharma Shubham Raj Laxmi
Assistant Professor 170110044
School of Computing-CSE CSE-CCV
D.I.T. University 3rd(6th sem)
Session 2019-20
INDEX
S.No Title of Experiment/Objective Date of Signature
Conduction of Faculty
1 Write a program in C to count number of spaces in a line.
2 Write a program in C to count number of characters, spaces, and
digits in a line.
3 Write a C program to identify whether a given line is a comment
or not.
4 Write a C program to recognize strings under 'a*' , 'abb', and
a*b+.
5 Write a C program to test whether a given identifier is valid or
not – l(l+d)$*.
6 Write a C program to test whether a given operator is valid or
not.
7 Write a program in Lex to print whether the word is a collection
of lowercase or upper case or mix
8 Write a program using Lex to print any arithmetic expression in
the form of tokens
9 Write a program in Lex to identify whether letter is consonant
or vowel.
10 Write a program in C language to verify, whether an input string
is accepted by the given grammar or not.
S ⇾aSb | ε
11 LEX program to recognizes the keyword (like: if, begin) and
identifier (which isdefined as any string starts with letter and
followed by letter or digit) and alsocount the number of
identifiers, keywords and operators encountered in the input.
Subject Name & Code:- Student Roll No:- 170110044
School of Computing
Department of Computer Science & Engineering
EXPERIMENT 1:
OBECTIVE:
Write a program in C to count number of spaces in a line.
CODE:
Subject Name & Code:- Student Roll No:- 170110044
School of Computing
Department of Computer Science & Engineering