Question: Using C#, implement a console application of the source code of a lexical analyzer (front.c) on page 166 in the textbook. Your console application should

Using C#, implement a console application of the source code of a lexical analyzer (front.c) on page 166 in the textbook. Your console application should receive an input (for example sum + 56/total) and give the similar output like on page 171.

Source Code in C:

Using C#, implement a console application of the source code of a

lexical analyzer (front.c) on page 166 in the textbook. Your console application

should receive an input (for example sum + 56/total) and give the

similar output like on page 171. Source Code in C: Output on

page 171: Show transcribed image text /* front.c-a lexical analyzer system for

Output on page 171:

simple arithmetic expressions #include #include /*Global declarations / /*Variables int charClass; char

Show transcribed image text

/* 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 ); Function declarations/ void addChar ) void getChar void getNonBlank () int lex ) /*Character classes #de fine LETTER 0 #de fine DIGIT 1 #de fine UNKNOWN 99 /*Token codes #de fine INT LIT 10 #de fine IDENT 11 #de fine ASSIGN OP 20 #de fine ADD OP 21 #de fine SUB OP 22 #de fine MULT OP 23 #define DIV OP 24 #define LEFT PAREN 25 #define RIGHT PAREN 26 default: addChar); nextToken = EOF; break; return nextToken; /* addChar - a function to add nextChar to lexeme / void addChar ) if (lexLen /*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 #de fine LETTER 0 #de fine DIGIT 1 #de fine UNKNOWN 99 /*Token codes #de fine INT LIT 10 #de fine IDENT 11 #de fine ASSIGN OP 20 #de fine ADD OP 21 #de fine SUB OP 22 #de fine MULT OP 23 #define DIV OP 24 #define LEFT PAREN 25 #define RIGHT PAREN 26 default: addChar); nextToken = EOF; break; return nextToken; /* addChar - a function to add nextChar to lexeme / void addChar ) if (lexLen

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!