Related articles |
---|
parsing bibtex file with flex/bison bnrj.rudra@gmail.com (2013-03-04) |
Re: parsing bibtex file with flex/bison drikosev@otenet.gr (Evangelos Drikos) (2013-03-06) |
Re: parsing bibtex file with flex/bison bnrj.rudra@gmail.com (Rudra Banerjee) (2013-03-07) |
Re: parsing bibtex file with flex/bison gah@ugcs.caltech.edu (glen herrmannsfeldt) (2013-03-08) |
Re: parsing bibtex file with flex/bison bnrj.rudra@gmail.com (Rudra Banerjee) (2013-03-17) |
Re: parsing bibtex file with flex/bison torsten.eichstaedt@FernUni-Hagen.de (Torsten =?UTF-8?B?RWljaHN0w6RkdA==?=) (2013-03-25) |
From: | Torsten =?UTF-8?B?RWljaHN0w6RkdA==?= <torsten.eichstaedt@FernUni-Hagen.de> |
Newsgroups: | comp.compilers |
Date: | Mon, 25 Mar 2013 13:41:30 +0100 |
Organization: | FernUni Hagen |
References: | 13-03-003 13-03-004 13-03-006 13-03-013 |
Keywords: | parse, practice |
Posted-Date: | 26 Mar 2013 01:59:44 EDT |
Rudra Banerjee wrote:
> The problem is, how I integrate this two code, i.e. put the $1, $3 of "
> KEY '=' VALUE ',' { printf("%s : %s\n",$1, $3); };" in the hash table.
RTFM man scanf ???
And for a more complete "real" program you may want to insert error handling
in your code, i.e. detect syntax errors and things like file not found etc..
Do I remember right that bison/flex info docs contain good hints how
to do that? Or there is a good HOWTO or docs in
/usr/share/doc/flex/bison or you search the net (some years past since
I wrote a parser w/ flex/bison). From my experience it is good to do
so (latest) once you have a working outline (frame), and it looks like
you have one. Do not make it too detailed, though, to not fog your
"real" code too much. Very likely you can subsume error cases for a
simple program.
Personally, I like the approach to start writing test cases and then fill in
the real code to fulfill the requirements. This helps you to make sure you
do not miss s/th and in many cases unveils simple flaws _early_ that we
usually insert when programming. I.e. you start w/ a program that fails --
but it tells you why! Then, step by step, your program solves the
requirements until you're satisfied (according to the test
cases/requirements). E.g.
/* very (too) simple implementation */
#ifdef TESTING
check( requirement_1 )
#endif
--
=|o)
Return to the
comp.compilers page.
Search the
comp.compilers archives again.