Question
Please include screen shots of code compiling using strings that are provided in question. All code must be written using C++ programming language. You will
Please include screen shots of code compiling using strings that are provided in question.
All code must be written using C++ programming language.
You will construct a class that defines a parser. This parser will be able to break up a string into tokens. A token is a distinct string of text it can be a word, a symbol, or a combination of these. Your parser will eliminate whitespace and break string snippets into individual tokens (where single-character tokens are defined at runtime).
Your parser should behave as follows:
1) Whitespace (spaces, tabs, and new lines) is used only to separate tokens otherwise, it is ignored.
2) Most tokens are made up of strings of text separated punctuation and other symbols.
3) In addition, single-character tokens (punctuation and/or other symbols) may be defined. The parser should treat symbols like any other text character. The default behavior will that all characters not separated by whitespace will be part of the same token. However, the parser will provide several functions that will allow the user to define additional, single-character symbols as token as well.
Target Output:
Input strings ------------- [{Oh what a loon() I am! Don't you agree?}] [I'll sing "Amazing Grace" for $5. Please call1 the #867-5309.]
Output Delimiting/Parsing by Whitespace only:
---------------
[ {Oh what a loon() I am! Don't you agree?} ] [ I'll sing "Amazing Grace" for $5. Please call1 the #867-5309. ]
Output Delimiting/Parsing by Block markers:
--------------
[ { Oh what a loon ( ) I am! Don't you agree? } ] [ I'll sing " Amazing Grace " for $5. Please call1 the #867-5309. ]
Output Delimiting/Parsing by Punctuation added:
------------------
[ { Oh what a loon ( ) I am ! Don ' t you agree ? } ] [ I ' ll sing " Amazing Grace " for $5 . Please call1 the #867-5309 . ]
Output Delimiting/Parsing by Symbols added:
--------------
[ { Oh what a loon ( ) I am ! Don ' t you agree ? } ] [ I ' ll sing " Amazing Grace " for $ 5 . Please call1 the # 867 - 5309 . ]
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