Skip to content

Project 1 lexical analyzer by Wesley Lancaster made in FALL 2022 made in JAVA

Notifications You must be signed in to change notification settings

weslanstr/lexicalAnalyzerJAVA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wesley Lancaster

dev specifications:

IntelliJ IDEA 2022.3.2 (Community Edition)

15 Oracle Open JDK version 15

Compile using the following command:
javac lexicalyzer.java

Run using the following command
javac lexicalyzer

Program usage:
the user will be prompter to enter the location of the file that user wants to be read.




------------------------------------------------------------------------------------
IMPORTANT NOTE:
Its important to note that while my program does utilize a scanner,
it only uses the scanner to read each LINE of the text file, which it then saves in a string called text.
I wrote my own .next() and .hasNext() method for reading lexemes in each line.

Basic Description:
My program reads the text file into a scanner, which then reads each line into a string,
which then calls its own .nextLine() and saves it into a String lexeme to be passed to .position() .value() and .kind()
to be analyzed.

Known issues:
-A deep looping issue is causing my code to read words/ lexemes in a peculiar way that can be annoying.
At its worst, it simply causes my code to sometimes reread lexemes.
This issue (for reasons far beyond my ability to understand) causes my .next() to repeat, or chop up words rarely and randomly.
Testing, by replacing my .next() method with the scanner's .next() confirms that the issue is with my code.
But after rewriting my .next() methods like 10 times, I really am not sure how my issue is possible.

-There are still a few instances where you can trick my code. EX:
'int' is keyword. 'intt' is a misspelled keyword unless its an ID. but 'in' will always be an id.

About

Project 1 lexical analyzer by Wesley Lancaster made in FALL 2022 made in JAVA

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages