|grammar help firstname.lastname@example.org (Peter Haynes) (2000-04-05)|
|Grammar help email@example.com (Randy Beckwith) (2002-06-28)|
|Re: Grammar help firstname.lastname@example.org (2002-07-02)|
|Re: Grammar help email@example.com (Casse Hugues) (2002-07-15)|
|From:||"Randy Beckwith" <firstname.lastname@example.org>|
|Date:||28 Jun 2002 18:11:25 -0400|
|Keywords:||parse, question, comment|
|Posted-Date:||28 Jun 2002 18:11:25 EDT|
I'm trying to write a simple grammar that will eventually be used with
Bison but have run into a snag. Basically, I'm trying to get at a list
rules_list := rule | rule rules_list
That's the easy part. <g> Now a rule can be based on CallerID,
CalledID, Date or ExcludeDate. There can be 0 or 1 CallerID, 0 or 1
CalledID, 0 or more Date and 0 or more ExcludeDate. I can do the the
"0 or 1's" and the "0 or more's" but can't figure out how to get them
As an example, you could have rule matches on:
CallerID AND CalledID
CallerID AND CalledID AND Date
Date AND Date
CallerID AND Date
CalledID AND Date AND ExcludeDate AND ExcludeDate
Thanks for your help.
[In a situation like this, it's often easier to match a more generic
list in the parser, then check semantically that the list is valid.
The parser is simpler, and you can produce much better error messages.
Return to the
Search the comp.compilers archives again.