Question: 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

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 Databases Questions!