Question: ILexical and Syntax Project Java Syntax ( Subset ) Programming Language The first part of this project is to design and implement a Lexical Analyzer

ILexical and Syntax Project
Java Syntax (Subset)
Programming Language
The first part of this project is to design and implement a Lexical Analyzer for a subset of the Java Programming Language. Your program should be able to accept as input a file containing statements in Java and correctly perform a lexical analysis of each statement. YOU JUST NEED TO USE THE WORDS INCLUDED IN THE TEXT FILE. YOU CAN NAME YOUR OWN TOKENS FOR THE LEXEMES.
Samples of the output and sample C code for a lexical analyzer for tokens and lexemes can be found in the textbook Chapter 4.2. You dont have to use the nmeric codes from the book; you can use your own tokens.
1. You will need to create a list (some structure to store) of the reserved words for Java that will be needed for an if-else type of conditional branch statement. (We worked on the BNF/EBNF in class.)
2. You will need to create a list of various operators used in Java by category, for example
token ASSIGN_OP
lexeme =
3. You will need to create a list of acceptable characters for variables and constants.(Again, just for the code given to you, including a couple of identifiers that dont work!)
4. You will need to write code to test the validity of identifiers (like the state diagrams from class). If a string does not match any of the categories, you should indicate that as UNKNOWN.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!