Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions