On Tue, Jun 27, 2006 at 09:04:27PM -0700, Dave Whipp wrote:
> I was reading the slides from PM's YAPC::NA, and a thought drifted into
> my mind (more of a gentle alarm, actually). One of the examples struck me:
> 
>   rule parameter_list { <parameter> [ , <parameter>]* }
> 
> Its seems common in the higher layers of a grammar that there are more
> non-terminal than terminals in each rule, so maybe the current "rule"
> isn't properly huffmanized (also, the comma seemed some-how out of place
> -- most symbols will need to be quoted if used in similar context). A
> more traditional YACC/YAPP coding of the
> rule would be:
> 
>   rule parameter_list { parameter [ "," parameter ]* }
> 
> Is there a strong reason (ambiguity) why every nonterminal needs to be
> quoted (or could we at least have a form ( C< rule:y {...} > ) where
> they are not)? I see this as increasingly important when rules are used
> to process non-textual streams. In these cases every token will need to
> be quoted using angle brackets, which at that point might become little
> more than line noise.

If we flipped the idea of "meta" such that only literals needed
quoting for rules, I'd expect that for consistency sake we'd need to
do the same for the other regexy things. For non-grammatical regexes,
that would start to grate real quick I think.  But maybe that's a good
dividing line--for m//, s///, and rx// you don't quote your literals,
and to match a rule, you use the regular assertion syntax. But
*within* a regex, token, or rule you need to quote your literals
because all non-quoted, wordish text is assumed to be an assertion.

Nah, that's as far as I'll entertain the thought because there is a
major show stopper--rules may be parameterized.  In the universe of
undelimited assertions, how are you to pass parameters to the assertion?
Use parens as in a subroutine call?  (rules are special subs after
all)  Sounds like it invites confusion.  Or would you mandate that to
get the effect of parameterized rules, you should really be using a
closure anyway?

So, I guess that answers your question ...

If not, I'm sure someone else will come along and give something more
definitive  :-)

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to