final

16
A Record on Practical Assignments In Compilers Laboratory-CSL618 SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE AWARD OF THE DEGREE OF BACHELOR OF ENGINEERING (COMPUTER SCIENCE AND ENGINEERING) SUBMITTED TO MS RAMAIAH INSTITUTE OF TECHNOLOGY,BANGALORE SUBMITTED BY Mithun R 1MS13CS414 SUPERVISED BY Prof. A. Parkavi Jan-May 2015

Upload: ankith-vernekar

Post on 17-Nov-2015

212 views

Category:

Documents


0 download

DESCRIPTION

final

TRANSCRIPT

A Record on Practical Assignments

In

Compilers Laboratory-CSL618

SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE AWARD OF

THE DEGREE OF

BACHELOR OF ENGINEERING (COMPUTER SCIENCE AND ENGINEERING)SUBMITTED TO

MS RAMAIAH INSTITUTE OF TECHNOLOGY,BANGALORE SUBMITTED BY Mithun R

1MS13CS414SUPERVISED BYProf. A. Parkavi Jan-May 2015

MS RAMAIAH INSTITUTE OF TECHNOLOGY

BANGALORE ACKNOWLEDGEMENTI express my sincere gratitude to Prof. A. Parkavi Dept. of Computer Science and Engineering, MSRIT, for her stimulating guidance, continuous encouragement and supervision throughout the course of present work.Signature(s) of Students

Mithun R

1MS13CS414CERTIFICATE

I hereby certify that the work which is being presented in the B.E entitled Record on Practical Assignments, in partial fulfillment of the requirements for the award of the Bachelor of Engineering in Computer Science & Engineering and submitted to the Department of Computer Science & Engineering of MS Ramaiah Institute of Technology an authentic record of my own work carried out during a period from Jan 2015 to May 2015( 6th semester) under the supervision of Prof. A. Parkavi ,Assistant professor CSE Department. Signature of Student (S)

Mithun RThis is to certify that the above statement made by the student(s) is correct to the best of my knowledge.

Signature of SupervisorDate: Name & Designation

Practical Assignment No: 1

Team Members : Problem Statement :Write a C program to validate the character constant used in a C program. Intimate the valid char constants, error char constants, along with their line numbers. If a character constant like '\0', \n\, '\t' are used, they have to bevalidated as valid.Program Solution: #include

#include

using namespace std;

int main()

{

ifstream infile("hi.cpp");

string s;

int lineno=0;

bool valid=true,open=0,close=0;

while(getline(infile,s))

{

lineno++;

valid = true;

for(int i=0;i