New Member FAQ | Forums | Earn Revenue


Resources Entrance Ask Experts Exam Papers Jobs English Projects Universities Colleges Courses Schools Training My India



My Profile
Active Members
TodayLast 7 Days more...



Awards & Gifts
Online Exams

Fresher Jobs


Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian cities including Bangalore, Chennai, Hyderabad, Pune or Kochi

Resources


Find educational articles, blogs, discussion threads and other resources.

Colleges


Find details about any college in India or search for courses.

website counter



Project To Check Syntax In A Given Code


Posted Date:     Total Responses: 0    Posted By: vishnuvardan   Member Level: Gold   Points/Cash: 3   


#include
#include
#include
#include
class syn
{
char s1[50];
public:
void syncheck();
};
void syn :: syncheck()
{
ifstream in;
in.open("out1.txt");
while(!in.eof())
{
in>>s1;
if(strcmp(s1,"if")==0)
{
in>>s1;
if(strcmp(s1,"(")==0)
{
in>>s1;
if(strcmp(s1,")")==0)
cout<<"\nNo Error";
else
cout<<"\nsyntax error missing ) in if";
}
else
cout<<"\nsyntax error missing ( in if";
}
else if(strcmp(s1,"while")==0)
{
in>>s1;
if(strcmp(s1,"(")==0)
{
in>>s1;
if(strcmp(s1,")")==0)
cout<<"\nNo error";
else
cout<<"\nSyntax error missing ) in while";
}
else
cout<<"\nSyntax error missing ( in while";
}
else if(strcmp(s1,"for")==0)
{
in>>s1;
if(strcmp(s1,"(")==0)
{
in>>s1;
if(strcmp(s1,";")==0)
{
in>>s1;
if(strcmp(s1,";")==0)
{
in>>s1;
if(strcmp(s1,")")==0)
cout<<"\nNo error";
else
cout<<"\nsyntax error missing ) in for";
}
else
cout<<"\nsyntax error missing : in 1st part of for";
}
else
cout<<"\nsyntax error missing ; in 2nd part of for";
}
else
cout<<"\nsyntax error missing ( in for";
}
}
in.close();
}
void main()
{
clrscr();
syn s;
s.syncheck();
getch();
}
-----------------------------------------------------------------------
Input:
if s > 0 ) for ( i = 0 ; i < n i++ ) while ( a > 1
-----------------------------------------------------------------------

Output:
syntax error missing ( in if
syntax error missing ; in 2nd part of for
Syntax error missing ) in while
-----------------------------------------------------------------------


Project Feedbacks


No feedbacks found. Be the first to respond and make money from revenue sharing program.

Post Feedback
You must Sign In to post a feedback.
Next Project: RUN TIME STORAGE MANAGEMENT
Previous Project: 3d transformation

Return to Project Index

Post New Project


Related Projects



Advertise Here





Contact Us   Advertise   Editors    Privacy Policy    Terms Of Use   

ISC Technologies.
2006 - 2009 All Rights Reserved.