Re: A better way to write parsed data

"Aaron Gray" <aarongray@beeb.net>
13 Jan 2002 22:58:26 -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: "Aaron Gray" <aarongray@beeb.net>
Newsgroups: comp.compilers
Date: 13 Jan 2002 22:58:26 -0500
Organization: Compilers Central
References: 01-12-174
Keywords: parse
Posted-Date: 13 Jan 2002 22:58:26 EST

Hello,
You might consider XML to represent your program semantics and use an
existing XML parser library.


Just another possibility,
        Aaron Gray


"mshetty" <mshetty@mail.com> wrote in message
> 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.