 
 public extension Operator {
     
+    public static let defaultPowerAssociativity: Operator.Associativity = {
+        
+        //determine what associativity NSPredicate/NSExpression is using
+        //mathematically, it should be Right associative, but it's usually parsed as Left associative
+        //rdar://problem/8692313
+        
+        let expression = NSExpression(format: "2 ** 3 ** 2")
+        let result = expression.expressionValueWithObject(nil, context: nil)
+        
+        if result.intValue == 512 {
+            return .Right
+        } else {
+            return .Left
+        }
+    }()
+    
     internal var builtInOperator: BuiltInOperator? { return BuiltInOperator(rawValue: self.function) }
     
     public init(builtInOperator: BuiltInOperator) {

//

import Foundation

private let DefaultPowerAssociativity: Operator.Associativity = {
    
    //determine what associativity NSPredicate/NSExpression is using
    //mathematically, it should be Right associative, but it's usually parsed as Left associative
    //rdar://problem/8692313
    
    let expression = NSExpression(format: "2 ** 3 ** 2")
    let result = expression.expressionValueWithObject(nil, context: nil)
    
    if result.intValue == 512 {
        return .Right
    } else {
        return .Left
    }
}()

public enum BuiltInOperator: String {
    case LogicalOr = "l_or"

            
            case .Power:
                self.arity = .Binary
                self.associativity = Operator.defaultPowerAssociativity
                self.tokens = ["**"]
            
            // Unary Right operators
