[prog] Yacc - double errors (EOF detection)

Kathryn Andersen kat_lists at katspace.com
Fri Feb 13 01:16:20 EST 2004


On Thu, Feb 12, 2004 at 10:39:22PM +1100, Sue Stones wrote:
> On Thu, 12 Feb 2004 09:17 pm, Kathryn Andersen wrote:
> > We (at work) use lex/yacc to do precisely that: to read in "complex
> > input format".  They are "rule" files, which define not only the
> > supporting data for this suite of programs, but also the constraints.
> 
> Can you give more details?  

Um, like what?

The parser is huge, because, for whatever reason, they decided to have
all the data and rules in one file (a scripts puts it together) and
parse that.  This happens to be a crew scheduling system, so the data in
question has sections for airport data, timezone data, coterm data,
connection data, block-time data, hotel data, currency data, for plane
schedules, for crew schedules, and for the many rules/constraints that
have to be satisfied in order for a generated schedule to be both legal
and optimal.  And all of this data is in ascii files, some of which get
generated by other systems, and others which are specific for this
suite.

For example, a plane schedule starts with the token "plane_sched", and
is followed by two or three dates, followed by a list of plane legs, and
ends with an "end" token.  Plane legs themselves are made up of a
date-range, days of the week, origin port, destination port, departure
time, arrival time, aircraft type, and a bunch of other data, some of
which is optional.

When you have data like that, which isn't something simple and regular
like CSV or XML, then you need something a bit more sophisticated to
parse it with.

-- 
 _--_|\     | Kathryn Andersen	<http://www.katspace.com>
/      \    | 
\_.--.*/    | GenFicCrit mailing list <http://www.katspace.com/gen_fic_crit/>
      v     | 
------------| Melbourne -> Victoria -> Australia -> Southern Hemisphere
Maranatha!  |	-> Earth -> Sol -> Milky Way Galaxy -> Universe


More information about the Programming mailing list