Hi ,

I want to write a program on Lexical Analyzer:

which finds the no of keywords, no of operators ( based on the classification arithmetic, logical,....), constants, and others.


please suggest me one good method.

i am using a method which follows as below:

char *Arith_Oper[]={ "+", "-", "*", "/", "%" };
:
:
and all other category of operators
char *KeyW[] = { "auto", "break",..... "while" };
:
:

i am using two functions
1. GetWord(); which gets a word from the file and one binary search function which
i want to use a fucntion getword which gets word from a file and this word is sent to all comaparisions to check the category and based on that that index of array is incremented and later once the all file is parsed the out put is displayed based on the count of that opearator or keyword.

i am using the Binarysearch function for finding the position of token .

but this method is not efficient as the token has to be compared with all the operators and keywords and others.

so i need a method which does in an effcient manner.


please help me.

Thanks,
Danian.

Yes Got it why there is no reply.

becaues there are hell lot of links provided in previous posts.

thanks all .

This question has already been answered. Start a new discussion instead.