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. 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

1 Expert Approved Answer
Step: 1 Unlock

Solution File Code include include include using namespac... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!