I have a message that can be defined thus:

msg
   : MSG34 blocks TERMINATOR
   ;

blocks
   : block
   | blocks block
   ;

block
   : optional_block
   | mandatory_block
   ;

optional_block
   : BLK1
   | BLK2
   | BLK3
   ;

mandatory_block
   : BLK7
   | BLK8
   | BLK9
   ;

So, message 34 is made up of blocks that can come in any order.  Some of the 
blocks are mandatory and some are optional.  All of the mandatory blocks must 
exist in order for the message to be valid.  


The problem with the grammar that I've written is that the mandatory blocks 
aren't required to be there (I want to have at least one of each mandatory 
block).  How can I define the grammar such that at least one of each mandatory 
block is required?

I'm guessing that I can't do it with the grammar itself and that I'll have to 
do 
some post processing once msg is matched.

Thanks,
Chris
_______________________________________________
[email protected] http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to