Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Grammar question

3 views
Skip to first unread message

al...@alfarrabio.di.uminho.pt

unread,
Aug 11, 2006, 11:43:55 AM8/11/06
to p6i
Hi

Today in #parrot a question was done:

rule foo { <bar>* }

should be considered:

rule foo { <?ws><bar>*<?ws> }

or

rule foo { <?ws>(<bar><?ws>)* }

?

Cheers
Alberto


--
Alberto Simões - Departamento de Informática - Universidade do Minho
Campus de Gualtar - 4710-057 Braga - Portugal

"Beware of bugs in the above code;
I have only proved it correct, not tried it."
--- Donald Knuth

Patrick R. Michaud

unread,
Aug 11, 2006, 1:01:31 PM8/11/06
to Alberto Simões, p6i
On Fri, Aug 11, 2006 at 04:43:55PM +0100, Alberto Simões wrote:
> Hi
>
> Today in #parrot a question was done:
>
> rule foo { <bar>* }
>
> should be considered:
>
> rule foo { <?ws><bar>*<?ws> }
>
> or
>
> rule foo { <?ws>(<bar><?ws>)* }

In the past we've always gone with the former.

If <bar> is also a rule, then it presumably
eats its own whitespace. If one wants
to grab the whitespace as well, as in the
latter example, it's not too difficult to write

rule foo { [<bar> ]* }

Pm

0 new messages