mozilla/sweet.js — pull request #296 by disnet (2014-04-07 00:23:59+00:00)
Title: Custom operators

Custom (honu-style) operator support. Still need to do a little bit of cleaning/testing before I merge. Here's the syntax I'm going with at the moment:

```js
unaryop neg 14 {$op} => #{ -$op }
binaryop plus 12 left { $lhs, $rhs } => #{ $lhs + $rhs }
```

The definition syntax is actually just a macro that desugars down to a primitive form:

```js
binaryop (plus) 12 left {
macro {
rule { ($left:expr) ($right:expr) } => {
$left + $right
}
}
}
```

One interesting question came up while I was working on this. How should we order precedence? The precedence table on [mdn](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence) is ordered from highest (0) to lowest (18), which seems a bit backwards since bigger numbers have lower precedence. I've flipped this for sweet.js so 0 binds least tightly and 18 binds most tightly. Is this the right choice or will people be confused because of the mdn page?