Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Update the Java code to get following output: ---------------------------------------------------------------------------------------------------------------------------------------------------------------- Input file(text file): ------------------------------------------------------------------------------------------------------------------------ Next token is: 25, Next lexeme is ( Enter Enter Enter Next

Update the Java code to get following output:

image text in transcribed

----------------------------------------------------------------------------------------------------------------------------------------------------------------

Input file(text file):

image text in transcribed

------------------------------------------------------------------------------------------------------------------------

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Next token is: 25, Next lexeme is ( Enter Enter Enter Next token is: 11, Next lexeme is sum Enter Enter Enter Next token is: 21, Next lexeme is + Exit factor> Exit Next token is: 10, Next lexeme is 47 Enter Enter Next token is: 26, Next lexeme is ) Exit factor> Exit Exit Next token is: 24, Next lexeme is / Exit Next token is: 11, Next lexeme is total Enter Next token is: -1, Next lexeme is EOF Exit factor> Exit Exit input1 - Notepad File Edit Format View Help | (sum + 47) / total import java.io.*; import java.util.*; public class trial { //Character classes private static final int LETTER=0; private static final int DIGIT=1; private static final int UNKNOWN=99; private static final int EOF=-1; //Token codes private static final int INT_LIT=10; private static final int IDENT=11; private static final int ADD_OP=21; private static final int SUB_OP=22; private static final int MULT_OP=23; private static final int DIV_OP=24; private static final int LEFT_PAREN=25; private static final int RIGHT_PAREN=26; private static final int SPACE=32; private static int precharclass = 7; private static boolean flag = false; private static int charclass; private static char lexeme[]; private static char nextchar; private static int lexLen; private static int nextToken; /* main driver code */ public static void main(String args[]) lexLen = 0; lexeme = new char[100]; for(int i=0; i Enter Enter Next token is: 11, Next lexeme is sum Enter Enter Enter Next token is: 21, Next lexeme is + Exit factor> Exit Next token is: 10, Next lexeme is 47 Enter Enter Next token is: 26, Next lexeme is ) Exit factor> Exit Exit Next token is: 24, Next lexeme is / Exit Next token is: 11, Next lexeme is total Enter Next token is: -1, Next lexeme is EOF Exit factor> Exit Exit input1 - Notepad File Edit Format View Help | (sum + 47) / total import java.io.*; import java.util.*; public class trial { //Character classes private static final int LETTER=0; private static final int DIGIT=1; private static final int UNKNOWN=99; private static final int EOF=-1; //Token codes private static final int INT_LIT=10; private static final int IDENT=11; private static final int ADD_OP=21; private static final int SUB_OP=22; private static final int MULT_OP=23; private static final int DIV_OP=24; private static final int LEFT_PAREN=25; private static final int RIGHT_PAREN=26; private static final int SPACE=32; private static int precharclass = 7; private static boolean flag = false; private static int charclass; private static char lexeme[]; private static char nextchar; private static int lexLen; private static int nextToken; /* main driver code */ public static void main(String args[]) lexLen = 0; lexeme = new char[100]; for(int i=0; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Update the Java code to get following output:...

Answered: 1 week ago