Question: Please help! I cannot seem to get this figured out... switch t 13 peivate Token scanLexsne endos-o Eesarn new TokenToknType.ASSIN d1essnessr.eqaalstonoreca (ntAD ) retuen new
switch t 13 peivate Token scanLexsne endos-o Eesarn new TokenToknType.ASSIN d1essnessr.eqaalstonoreca" (ntAD" ) retuen new Token (Lexemesct, Tokentype READ it return new Token[" TokenType.ERROR else t 1exemeStE.equalaignoeCasel"WRITE return new Token (lexeS,TokenType. WRITED 259 ile ek.ypet Tesentype.son etoen (aerins.uori. Teentyne Pu 336 ess sew Tokeneing.nalunorion). ToeatypeMEn StrnG.lunctch Tes.RRC 1. Modify the Scanner to include true and false keywords, that are not id tokens, but their own token types TRUE and FALSE. An example statement using these might be: isTesttrue 2. Modify the Scanner to include int and bool keywords, that are not id tokens, but their own token types INTEGER and BOOLEAN (note keyword and type differs slightly). An example statement using these might be: bool A int B 3. Modify the Scanner to include a unary "" operator with a NOT token type. For example, A B write !A 4. Modify the Scanner to handle a left (LPAREN) and right (RPAREN) parenthesis tokens. When finished it should be able to support statements like (not 'cos is simply an id: write (A B) C cos (A) 5. Modify the Scanner to use a semi-colon to delimit a statement. For example, the following source code examples should be handled read Ai read B sum :-: A + B; write sum: write sum2 read beta: sum : alpha + beta i Modify the Java code for the Scanner to "preprocess" Java-style comments. Tokens should not be created for such comments. Strip them out of the input code. 6. a. Single line comments that begin with "r b. Multi-line comments that begin with "7 and end with "r. switch t 13 peivate Token scanLexsne endos-o Eesarn new TokenToknType.ASSIN d1essnessr.eqaalstonoreca" (ntAD" ) retuen new Token (Lexemesct, Tokentype READ it return new Token[" TokenType.ERROR else t 1exemeStE.equalaignoeCasel"WRITE return new Token (lexeS,TokenType. WRITED 259 ile ek.ypet Tesentype.son etoen (aerins.uori. Teentyne Pu 336 ess sew Tokeneing.nalunorion). ToeatypeMEn StrnG.lunctch Tes.RRC 1. Modify the Scanner to include true and false keywords, that are not id tokens, but their own token types TRUE and FALSE. An example statement using these might be: isTesttrue 2. Modify the Scanner to include int and bool keywords, that are not id tokens, but their own token types INTEGER and BOOLEAN (note keyword and type differs slightly). An example statement using these might be: bool A int B 3. Modify the Scanner to include a unary "" operator with a NOT token type. For example, A B write !A 4. Modify the Scanner to handle a left (LPAREN) and right (RPAREN) parenthesis tokens. When finished it should be able to support statements like (not 'cos is simply an id: write (A B) C cos (A) 5. Modify the Scanner to use a semi-colon to delimit a statement. For example, the following source code examples should be handled read Ai read B sum :-: A + B; write sum: write sum2 read beta: sum : alpha + beta i Modify the Java code for the Scanner to "preprocess" Java-style comments. Tokens should not be created for such comments. Strip them out of the input code. 6. a. Single line comments that begin with "r b. Multi-line comments that begin with "7 and end with "r
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
