Nothing Special   »   [go: up one dir, main page]

Compiler Design Project

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

PROJECT REPORT

OF
“Compiler Design”

Submitted in partial fulfillment of the requirements for the award degree


of

Bachelor of Technology
In

Computer Science and Engineering

Bundelkhand Institute of Engineering and Technology, Jhansi (U.P)


(BIET Jhansi)
ACADEMIC SESSION 2023-24

Submitted by
Bhaskar Yadav (2100430100012)
Shikha Singh (2200430109004)
Shishir Singh (2100430100047)

Under the guidance of


Prof. Sanjai Kumar Gupta
ACKNOWLEDGEMENT

We are indebted to our respected Head of the Department Dr. Yashpal Singh for guiding us.

The team is also grateful to our project guide Prof. Sanjai Kumar Gupta, for their

invaluable guidance for this project. We also thank our respected faculty members of the

Computer Science and Engineering department for their indomitable contribution and

guidance without which this project would have been impossible to complete.Our sincerest

thanks to all the teachers, seniors and colleagues whose help and guidance brought this project

to successful completion.

Submitted by:

Bhaskar Yadav (2100430100012)


Shikha Singh (2200430109004)
Shishir Singh (2100430100047)
EXPERIMENT
OBJECTIVE:

Write a C program to test whether a given identifier is valid or not

RESOURCE:

C++

PROGRAM LOGIC:

Read the given input string.


Check the initial character of the string is numerical or any special character except ‘_’ then
print it is not a valid identifier.
Otherwise print it as valid identifier if remaining characters of string doesn't contains any
special characters except ‘_’

PROCEDURE:

Go to run or press Ctrl+Atl+N run the program.

PROGRAM:
#include<stdio.h>
#include<conio.h>
#include<ctype.h>
#include<iostream>
using namespace std;
int main()
{
char a[10];
int flag,i=1;
cout<<"\n Enter an Identifier:";
gets(a);
if(isalpha(a[0]))
{
flag=1;
}
else
{
cout<<"\n Not A valid identifier:";
}
while (a[i]!='\0')
{
if(!isdigit(a[i]) && !isalpha(a[i]))
{
flag=0;
break;
}
i++;
}
if(flag==1)
{
cout<<"\nValid Identifier";
}
return 0;
}

INPUT & OUTPUT:

You might also like