Re: Returning from Rules

2004-05-06 Thread Larry Wall
On Mon, Apr 19, 2004 at 01:06:29AM -0600, Luke Palmer wrote: : Therefore, the first syntax can be redefined to evaluate the code block : and assign the result to $0. The example now becomes: : : rule list { : , <{ make_node('list', $?term, $?list) }> : | <{ $?term

Re: Returning from Rules

2004-05-03 Thread Luke Palmer
Jeff Clites writes: > On Apr 19, 2004, at 12:06 AM, Luke Palmer wrote: > > >Therefore, the first syntax can be redefined to evaluate the code block > >and assign the result to $0. > > Would you ever want to leave $0 unaltered? That's the only concern > which comes to mind. Absoultely: if you wa

Re: Returning from Rules

2004-05-03 Thread Jeff Clites
On Apr 19, 2004, at 12:06 AM, Luke Palmer wrote: Therefore, the first syntax can be redefined to evaluate the code block and assign the result to $0. Would you ever want to leave $0 unaltered? That's the only concern which comes to mind. My argument for using this notation stems from the fact th

Re: Returning from Rules

2004-05-03 Thread Smylers
Luke Palmer writes: > <{ get_rule() }># call an anonymous rule returned by the code block > > Can also be written: > > <$( get_rule() )> > > Therefore, the first syntax can be redefined to evaluate the code block > and assign the result to $0. The example now becomes: > > rule

Returning from Rules

2004-04-19 Thread Luke Palmer
I notice that when I write a grammar, I end up doing this an awful lot (in P::RD notation): list: term ',' list { make_node(@item[0,1,3]) } | term { $item[1] } With attention on the actions, and assuming is on. In Perl 6, aside from the fact that there's a clearly better wa