On Fri, May 06, 2005 at 12:23:49PM +1000, Stuart Cook wrote:
> On 5/6/05, Stuart Cook <[EMAIL PROTECTED]> wrote:
> > (snip) As long as each meta-operator
> > explicitly knows what type of regular operator it accepts (and
> > produces), there shouldn't be any problems with ambiguity.
> > 
> 
> Having posted that, I immediately thought of some problems:
> 
> If a meta-operator has
> {meta-fixity => prefix|circumfix, result-fixity => prefix}
> then it can be confused with a term, e.g.:
> 
> $x = [+1, -2, +3]; # opening [ indicates a term
> $y = [+] @stuff; # opening [ indicates a meta-op producing a prefix operator
> 
> This might confuse the parser, though I suppose you could always try
> both possibilities and see which one works.

It might not be a problem -- I'm thinking we may end up tokenizing 
most or all of the meta operators, so that [+] would be considered 
its own token, and then the "longest matching token" rule
would be sufficient to disambiguate the terms:

  $x = [+1, -2, +3]; # token [ indicates a term
  $y = [+] @stuff; # token [+] indicates a meta-op prefix operator

Or, the entry for the reduce meta operator might look something like

        %prefixmetaops[ rx / \[ %infixops \] / ] = ...

in which case the parser would still be able to easily disambiguate
the differences when it's expecting an operator.

Pm

Reply via email to