Question: Write a java program to recognize the Relational Operators , >= and > (use the logic similar. to the code given in figure 3.18). Whenever

Write a java program to recognize the Relational Operators , >= and > (use the logic similar. to the code given in figure 3.18). Whenever any of these relational operators are matched, your project should also print the token name "relop" and the attribute value LT, LE, EQ, NE, GE or GT respectively (after printing the relational operator. TOKEN getRelop() { TOKEN ret Token = new (RELOP); while(1) { /* repeat character processing until a return or failure occurs */ switch(state) { case 0: c = nextChar(); if (c == ' ) state = 6; else fail(); /* lexeme is not a relop */ break; case 1: ... case 8: retract(); retToken.attribute = GT; return(ret Token); } } Figure 3.18: Sketch of implementation of relop transition diagram } Khawaja 2020
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
