Answered step by step
Verified Expert Solution
Question
1 Approved Answer
write a C++ program that reads in a text file and reads each character or lexemes and states what token it is and writes to
write a C++ program that reads in a text file and reads each character or lexemes and states what token it is and writes to another file
for example:
while (fahr < upper) a = 23.00 whileend
Output:
token lexeme
--------------------------------
keyword while
separator (
identifier fahr
operator <
identifier upper
separator )
identifier a
operator =
real 23.00
keyword whileend
the program aslo reads in comments but does not add to the list. characters that are commented out or pseudocode is not counted
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started