help-bison
[Top][All Lists]
Advanced

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

Re: stupid format question


From: Tim Van Holder
Subject: Re: stupid format question
Date: 28 Feb 2003 11:07:04 +0100

On Thu, 2003-02-27 at 23:07, Urdaneta, Alfonso E (N-Summitt
Technologies) 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
>     ;

Don't use recursion if you don't want a sequence.
The rules below should do what you want (I am assuming the [] around the
USING clause mean that it is optional; if not, drop the 'optional_'
prefix from the rule, and remove its 'empty' part).

noun_field
: noun_or_noun_name optional_using_label
;

noun_or_noun_name
: noun
| noun_name
;

optional_using_label
: /* empty */
| USING_TOKEN label_identifier
;

-- 
Tim Van Holder <address@hidden>





reply via email to

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