A better way to write parsed data

mshetty@mail.com (mshetty)
29 Dec 2001 13:28:14 -0500

          From comp.compilers

Related articles
A better way to write parsed data mshetty@mail.com (2001-12-29)
Re: A better way to write parsed data vannoord@let.rug.nl (2002-01-03)
Re: A better way to write parsed data ddevilliers@lando.co.za (D De Villiers) (2002-01-03)
Re: A better way to write parsed data aarongray@beeb.net (Aaron Gray) (2002-01-13)
| List of all articles for this month |
From: mshetty@mail.com (mshetty)
Newsgroups: comp.compilers
Date: 29 Dec 2001 13:28:14 -0500
Organization: http://groups.google.com/
Keywords: parse, question, comment
Posted-Date: 29 Dec 2001 13:28:13 EST

Hi,


I am parsing a line of data. Something like
"name=abc" and then generating --> class abc


I carry out this process of parse and write, n times.
For example :
AccessSpecifier=public
then I print "public"


In this manner I generate the entire class. So, my code looks like
readline(keyword, value);
outfile << "class " << value << endl << "{" << endl;
readline(keyword, value);
outfile << value << endl;


Is there a better way of doing this ??


Would help if I could get some comments on this.


Thanks and Regards,
M Shetty
[Kind of depends on the overall project. If you really only have two
or three keywords you need to handle, a little hand-coded program
like this is fine. If it's bigger than that, you probably want to
put the interesting parts in tables, or perhaps let yacc generate the
tables for you. -John]


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.