Question: import java, util.List: public class PLO2_Lexer f If PL62_Token is an abstract class, it is the parent class of all tokens. II 11 There are
import java, util.List: public class PLO2_Lexer f If PL62_Token is an abstract class, it is the parent class of all tokens. II 11 There are three types of tokens, capturing three kinds of non-empty strings, devoid of spaces 11 - PLO2_TokenInt unsigned integer (no decimal point), eg: "4". " 502" 11 - PLe2_Token0p "+" or " " 11. PLO2_Tokenstr others, eg: "apple", "abcs+x", "+++", "-+" 11 1/ The method "tokenize" breaks an expression into chunks, and return a list of the tokens of II the corresponding chunks. 1/ Il Exasple: 11 exprn 15: " 234+679 ice6 ++7=8.9 " 11 chunks are: "234" "+" "67" "-" "9" "ice" "6" "++" " " " " " 8 " ", "9" 1/ token types: Int 0p Int 0p Int str Int str op op Int str Int If Chunks are delimited by spaces, and transition between digit-char and non-digit-char 1/ 11. The following features are NoT allowed in this program: II trim split indexof contains parseInt If parsedouble regex Pattern Matcher catch try II endswith startsWith StringBuffer StringBuflder II format Integer Double Long valueof I/ Float Byte Math substring concat replace /f replaceAtl matches isDigit If public static List (): ) // Hint: II hence the result of tokenize (exprn) can be coded as follows: II 11. System.out.println(exprn): /1 out = new Arraylist >()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
