Please develop a Lexical Analyzer in Java that gets the file and separates the Tokens and Lexemes as shown in the picture below.
file 1 content :
//Test 1
function a()
x = 1
print(x)
end
file 2 content:
//test 2
function a()
x = 1
while
x += x 1
end
print(x)
end
Output:
Lexeme
function
a
(
)
X
=
1
if
X
1
then
print
(
8
)
else
print
(
1
)
end
end
Success!
Symbol
FUNCTION
IDENTIFIER
OPEN_PARENTH