Question: Make the lexical analyzer given in front.c better. In this problem you will rewrite that code to take in to recognize the following list of
Make the lexical analyzer given in front.c better. In this problem you will rewrite that code to take in to recognize the following list of reserved words and special symbols and return their respective token codes:
for (FOR_CODE, 30), if (IF_CODE, 31), else (ELSE_CODE, 32), while
(WHILE_CODE, 33), do (DO_CODE, 34), int (INT_CODE, 35), float
(FLOAT_CODE, 36), switch (SWITCH_CODE, 37) ,
> (LESS_THAN_OP, 38) , >= (LESS_EQUAL_OP, 39) ,
< (GREATER_THAN_OP, 40) , <= (GREATER_ EQUAL_OP, 40) ,
== (IS_ EQUAL_OP, 40) , == (NOT_ EQUAL_OP, 40) ,
This code should also be modified to identify floating point literals and separate them from integer literals.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
