Question: Basic.java must contain main. - There must be only one argument (args) and if there are none or more than 1, an error message must
Basic.java must contain main.
- There must be only one argument (args) and if there are none or more than 1, an error message must be printed and the program exits
- That one argument will be considered a filename
- Use File.ReadAllLines to read all of the lines from the file that is denoted by filename
- Instantiate one instance of your Lexer class for each line from ReadAllLines
- Parse each line using the lex method of the Lexer class
- Take the list of tokens from lex and concatenate it to a single list. If lex throws an exception you must catch the exception, print that there was an exception, and lex the next line
- Print each token out once the lexing is complete
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
