Question: THE QUESTION IS : Explain what does the code do and what is the input. What is the output? What does the code checks? 10:03

THE QUESTION IS :
Explain what does the code do and what is the input.
What is the output?
What does the code checks?
 THE QUESTION IS : Explain what does the code do and
what is the input. What is the output? What does the code
checks? 10:03 4G lexicalAnalyzer.c /*front.c a lexical analyzer system for simple arithmetic
expressions/ include winclude Global declarations Variables/ int charClass; char lexeme [100] char

10:03 4G lexicalAnalyzer.c /*front.c a lexical analyzer system for simple arithmetic expressions/ include winclude Global declarations Variables/ int charClass; char lexeme [100] char nextChar int lexLen; int token; int nextToken FILE in_fp, *fopen ) Function declarations/void addChar) void getChar ): void getNonBlank) int lex *Character classes #define LETTER 0 #define DIGIT 1 define UNKNOWN 99 Token codes #define INT LIT 10 #define IDENT 11 #define ASSIGN OP 20 #define ADD OP 21 #de fine SUB OP 22 #de fine MULT OP 23 #de fine DIV OP 24 #define LEFT PAREN 25 #define RIGHT PAREN 26 main driver * main) ( Open the input data file and process its contents */ if ((in-fp = fopen ("front.in., "r")) t= NULL ) printf("ERROR- cannot open front.in n") else getChar do lex() } while (nextToken != EOF); Open With Print 10:03 lexicalAnalyzer.c / * *lookup - a function to lookup operators and parentheses and return the token int lookup(char ch) switch (ch) case : addChar) nextToken LEFT PAREN; break; case addChar nextToken = RIGHTPAREN; break ; case + addChar(); nextToken = ADD OP; break; case-i addChar nextToken SUB OP: break; - addChar nextToken MULT OP; break; case /: addChar(); nextToken = DIV OP; break; default: addChar(); nextToken = EOF; break; return nextToken;h addChar a function to add nextChar to lexeme */ void addChar) t if (lexlen /* End of function lex */ 10:03 4G lexicalAnalyzer.c /*front.c a lexical analyzer system for simple arithmetic expressions/ include winclude Global declarations Variables/ int charClass; char lexeme [100] char nextChar int lexLen; int token; int nextToken FILE in_fp, *fopen ) Function declarations/void addChar) void getChar ): void getNonBlank) int lex *Character classes #define LETTER 0 #define DIGIT 1 define UNKNOWN 99 Token codes #define INT LIT 10 #define IDENT 11 #define ASSIGN OP 20 #define ADD OP 21 #de fine SUB OP 22 #de fine MULT OP 23 #de fine DIV OP 24 #define LEFT PAREN 25 #define RIGHT PAREN 26 main driver * main) ( Open the input data file and process its contents */ if ((in-fp = fopen ("front.in., "r")) t= NULL ) printf("ERROR- cannot open front.in n") else getChar do lex() } while (nextToken != EOF); Open With Print 10:03 lexicalAnalyzer.c / * *lookup - a function to lookup operators and parentheses and return the token int lookup(char ch) switch (ch) case : addChar) nextToken LEFT PAREN; break; case addChar nextToken = RIGHTPAREN; break ; case + addChar(); nextToken = ADD OP; break; case-i addChar nextToken SUB OP: break; - addChar nextToken MULT OP; break; case /: addChar(); nextToken = DIV OP; break; default: addChar(); nextToken = EOF; break; return nextToken;h addChar a function to add nextChar to lexeme */ void addChar) t if (lexlen /* End of function lex */

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!