Question: Youaregivenacopyof lex.hfromProgrammingAssignment2,andafilecalled tokensListing.cppas a driver program. DO NOT CHANGE tokensListing.cpp Your implementation should include the followingin another file, called io.cpp: Creating a static map container
Youaregivenacopyof lex.hfromProgrammingAssignment2,andafilecalled tokensListing.cppas a driver program.
DO NOT CHANGE tokensListing.cpp
Your implementation should include the followingin another file, called io.cpp:
Creating a static map container that defines the list of tokens and their associated string. The declaration is:static map
Writingcode to implement the operator<< overloaded methodfor LexItem.
Use the given driverprogram in tokensListing.cppfor testingyour implementation.For example, the output of the testing program displays the following:
PRINT Line #: 3
IF Line #: 3
BEGIN Line #: 3
END Line #: 3
IDENT (area) Line #: 3
ICONST (579) Line #: 3
SCONST (hello NJIT) Line #: 3
RCONST (5.79) Line #: 3
PLUS Line #: 3
MINUS Line #: 3
MULT Line #: 3
DIV Line #: 3
EQ, Line #: 3
LPAREN Line #: 3
RPAREN Line #: 3
SCOMA Line #: 3
COMA Line #: 3
ERR (ERR) Line #: 3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
