: : hi all,
: : i have a 4 part assignment that is to write
: : [1:lexical analyzer][2:parser][3:symbol table][4:simulator]
: : these have to be built using modules? my lex will read in a .txt file that contains int i;
: : int n = 4 ;
: : float sum ;
: :
: : for ( i = 0 ; i < n ; i = i + 1 )
: : {
: : sum = sum + 1 ;
: : } ;
: :
: : i can read this from a .txt file to the screen; but i am pretty sure that inorder to move to the next step, i need to tokenize each character. that is the first problem. i can use whitespace as my delimeter. once the file is tokenized i need to pass it as a module to a state machine for parsing.
: :
: : i am stuck. if i could get help with the creation of the tokens i would be off to a better start.
: :
: : thanks
: :
: I've written a function called StringSplit(), which can take a part from a larger string. See the
http://www.codepedia.com/1/StringSplit for the source. This will come helpful in tokenizing the text.
:
hi, and thank you. it looks like i can set the delimiter to the whitespace, and break the string up nicely.