help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: stupid format question


From: Vincent Zweije
Subject: RE: stupid format question
Date: Fri, 28 Feb 2003 09:23:36 +0100

Alfonso Urdaneta wrote:

||  I have an IEEE language definition that looks like so:
||  
||  noun-field:
||      { noun | 
||        noun-name } [ "USING" label-identifier ];
||  
||  now my first thought is that in bisonland this would look 
||  like so (I have omitted dependencies)
||  
||  noun_field:
||      { noun | noun_name }
||      | noun_field USING_TOKEN label_identifier
||      ;

No, you've built a recursive noun_field which can repeat itself.

Clearest is probably an extra rule for the optional stuff,
and once you start using attributes you will want to split the
choice into two rules as well.

    noun_field: noun_or_noun_name using-option;

    noun_or_noun_name: noun;
    noun_or_noun_name: noun_name;

    using_option: /*empty*/ ;
    using_option: "USING" label-identifier;

||  but then this will match
||  
||    noun USING label USING label USING label....
||  
||  which I don't want.
||  
||  I couldn't find anything in the docs that said anything 
||  about how to limit sequences.

It's not a question of limiting a sequence, it's a question
of not generating one in the first place.

Ciao.                                                   Vincent.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]