Monday, January 18, 2010

Parser – Variables

The Parser only requires only a few variables:

    char *input  – pointer to input line being processed
    char *pos  – pointer to the current position within the input line
    Token *token  – pointer to the token that will be filled and returned

The start() function will set the input and pos variables to the input line it is given. Each call to get_token() will start by allocating a new token to which it's pointer is put into the token variable. Remember that even errors returned will require a token. Next Before beginning to see what token type is at the current position, any white space is skipped.

No comments:

Post a Comment

All comments and feedback welcomed, whether positive or negative.
(Anonymous comments are allowed, but comments with URL links or unrelated comments will be removed.)