Question: tokens. Detect character patterns for operators and return corresponding 1. Next comes tokens like operators which may contain one or two characters like for
tokens. Detect character patterns for operators and return corresponding 1. Next comes tokens like operators which may contain one or two characters like for example: addition operator may be a single character +, but C language also supports ++ and += operators. So, when lexical analyzer finds first + character it must input another character and check whether it is another + or = character or some character other than +, F. If the character is + then lexical analyzer must return token for PlusPlus, and if the character is the lexical should return token for PlusEq token. And if the second character is other than + or= then it must return token for PLUS only. (and lexical should delay for one time reading next character and use the second character as the next input character) (the point is that the lexical should try to use as many characters from the input string as possible-- i.e. Lexical tries to match the longest substring of the string) Your task is to recognize all possible operators which may start with the same character.
Step by Step Solution
3.52 Rating (149 Votes )
There are 3 Steps involved in it
Solution File Code include include include using namespac... View full answer
Get step-by-step solutions from verified subject matter experts
