Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #877

Re: parsing bibtex file with flex/bison

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!news.glorb.com!news-out.readnews.com!news-xxxfer.readnews.com!news.misty.com!news.iecc.com!.POSTED!nerds-end
From Torsten Eichstädt <torsten.eichstaedt@FernUni-Hagen.de>
Newsgroups comp.compilers
Subject Re: parsing bibtex file with flex/bison
Date Mon, 25 Mar 2013 13:41:30 +0100
Organization FernUni Hagen
Lines 30
Sender johnl@iecc.com
Approved comp.compilers@iecc.com
Message-ID <13-03-016@comp.compilers> (permalink)
References <13-03-003@comp.compilers> <13-03-004@comp.compilers> <13-03-006@comp.compilers> <13-03-013@comp.compilers>
NNTP-Posting-Host news.iecc.com
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 8bit
X-Trace leila.iecc.com 1364277585 31419 64.57.183.58 (26 Mar 2013 05:59:45 GMT)
X-Complaints-To abuse@iecc.com
NNTP-Posting-Date Tue, 26 Mar 2013 05:59:45 +0000 (UTC)
Keywords parse, practice
Posted-Date 26 Mar 2013 01:59:44 EDT
X-submission-address compilers@iecc.com
X-moderator-address compilers-request@iecc.com
X-FAQ-and-archives http://compilers.iecc.com
Xref csiph.com comp.compilers:877

Show key headers only | View raw


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)

Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

parsing bibtex file with flex/bison bnrj.rudra@gmail.com - 2013-03-04 15:48 -0800
  Re: parsing bibtex file with flex/bison Evangelos Drikos <drikosev@otenet.gr> - 2013-03-06 13:45 +0200
    Re: parsing bibtex file with flex/bison Rudra Banerjee <bnrj.rudra@gmail.com> - 2013-03-07 11:20 +0000
      Re: parsing bibtex file with flex/bison Rudra Banerjee <bnrj.rudra@gmail.com> - 2013-03-17 00:18 +0000
        Re: parsing bibtex file with flex/bison Torsten Eichstädt <torsten.eichstaedt@FernUni-Hagen.de> - 2013-03-25 13:41 +0100
  Re: parsing bibtex file with flex/bison glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-03-08 03:59 +0000

csiph-web