Hi,
I am still new to C++ and have a quick question:
what exactly is a parser??
Thanks for any explanations.
Hi,
I am still new to C++ and have a quick question:
what exactly is a parser??
Thanks for any explanations.
To parse something means to break it into smaller pieces. For example, say you have the string:
Hello world!
You can parse this string into two substrings based on the space between the two words. You can parse it into 4 three letter strings if you want. You can parse it into 12 individual charactters if you prefer. You can parse it into three strings using the character '0' as a delimiter. You can parse it into 4 strings using the character 'l' as a delimiter. etc. etc. etc.
As another example you can parse an int like: 321
into three individual ints using a sequence of % and / in combination.
int num = 321;
int parsed[3];
parsed[2] = num % 10;
num /= 10;
parsed[1] = num % 10;
num /= 10;
parsed[0] = num;
for(int i = 0; i < 3; ++i)
cout << num << endl;
You have to decide how you want to break down (parse) whatever it is you want to parse. A parser is a routine that does the parsing.
Last edited by elad; 07-30-2003 at 09:28 AM.