Description: You are required to implement a Scanner program for Java programming language in any programming language. The program should be able to accept the input from the file provided by the user. The scanner will then scan the code file and identifies all the tokens and list them as the output for user. In case of an invalid token, Scanner should mention that a given token is invalid. The scanner should consider following token categories;   Pre-Processing: Before scanning the code your program shall pre-process the input code and remove all the single-line and multi-line comments from the code.   Token Categories Keywords All Keywords Special Symbols Assignment Operator = Unary Operators ++ -- ! Arithmetic Operators + - * / % Relational Operators < <= > >= == != Conditional Operators && || Symbols ( ) { } [ ] . , ; : ‘’ “” Identifier Integer Positive & Negative Real Number Positive & Negative Character Literal String Lit

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter10: Classes And Objects
Section: Chapter Questions
Problem 17RQ
icon
Related questions
Question

Description: You are required to implement a Scanner program for Java programming language in any programming language. The program should be able to accept the input from the file provided by the user. The scanner will then scan the code file and identifies all the tokens and list them as the output for user. In case of an invalid token, Scanner should mention that a given token is invalid. The scanner should consider following token categories;

 

Pre-Processing: Before scanning the code your program shall pre-process the input code and remove all the single-line and multi-line comments from the code.

 

Token Categories

  • Keywords
    • All Keywords
  • Special Symbols
    • Assignment Operator
      • =
    • Unary Operators
      • ++ -- !
    • Arithmetic Operators
      • + - * / %
    • Relational Operators
      • < <= > >= == !=
    • Conditional Operators
      • && ||
    • Symbols
      • ( ) { } [ ] . , ; : ‘’ “”
    • Identifier
    • Integer
      • Positive & Negative
    • Real Number
      • Positive & Negative
    • Character Literal
    • String Literal
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning