Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can someone run this lexical analyzer code correctly?

Status
Not open for further replies.

DonCL

Programmer
Jul 16, 2001
43
US
Hello, i am researching lexical analyzers and i was wondering if anyone can run this code properly. I get it to run in visual c++, but i just get the dos window with no activity. it is a long program, here is the link:
also, you must add #include<ctype.h> to the program in order for it to run. what am i doing wrong? i tried this at the command line since it is using the unix pipe: type test.txt | cmp. cmp is the name of the file.
thanks for any help.
 
Where exactly is the code? I went to the home page which had lots of flashing balls and not much else. Might be my browser is not set up to display what you have on your home page so I can't get any further.
 
Hi,
I am not sure for what exactly you are upto but beware in code using of pointer is being made slightly wrong in gettoken(..)function...anyway for your refernce I am giveing you a sample code..you can use it in simliar sort of ways..

char *pMy[1];
int iVal;
pMy[0]=&quot;Pankaj&quot;;

pMy[1]=&quot;Neeraj&quot;;

pMy[2]=&quot;Nandu&quot;;

pMy[3]=&quot;3&quot;;

iVal=atoi(pMy[3]);

for(int i=0;i<4;i++)
printf(&quot;\n%s&quot;,pMy);

iVal=strlen(pMy[0]);
printf(&quot;\n\7%s&quot;,pMy[0][0]);


char szBuff[8];
strcpy(szBuff,&quot;Pankaj&quot;);
printf(&quot;\n%s&quot;,szBuff);

Although I have your code compiled but it is not as such producing any out put as it is stucking in beginning at the line &quot; while( gets(temp ) != NULL)&quot;...if you want that code let me know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top