Question: Convert the lexical analyzer (which is written in C) given in Section 4.2 of the book to Java, and it to recognize the following list

Convert the lexical analyzer (which is written in C) given in Section 4.2 of the book to Java, and it to recognize the following list of reserved words 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).

Code in Section 4.2 is :

Convert the lexical analyzer (which is written in C) given in Section4.2 of the book to Java, and it to recognize the followinglist of reserved words 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). Code inSection 4.2 is : /* front.c-a lexical analyzer system for simple arithmetic

/* front.c-a lexical analyzer system for simple arithmetic expressions / #include #include /*Global declarations* /* Variables / int charClass; char lexeme [100]; char nextChar; int lexLen int token; int nextToken; FILE *in fp, *fopen () /* front.c-a lexical analyzer system for simple arithmetic expressions / #include #include /*Global declarations* /* Variables / int charClass; char lexeme [100]; char nextChar; int lexLen int token; int nextToken; FILE *in fp, *fopen ()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!