     func parse(string: String, inout empty outEmpty: Bool) throws -> Expression {
         enum State {
             case Error(String)
-            case Initial
+            case WaitingForAnyExpression
             case LeadingDot
-            case Identifier(start: String.Index)
-            case WaitingForIdentifier
-            case IdentifierDone
-            case FilterDone
+            case Identifier(identifierStart: String.Index)
+            case CompoundIdentifier(identifierStart: String.Index, baseExpression: Expression)
+            case WaitingForCompoundIdentifier(baseExpression: Expression)
+            case IdentifierDone(expression: Expression)
+            case FilterDone(expression: Expression)
             case Empty
             case Valid(expression: Expression)
         }
         
-        var state: State = .Initial
+        var state: State = .WaitingForAnyExpression
         var filterExpressionStack: [Expression] = []
-        var currentExpression: Expression?
         
         var i = string.startIndex
         let end = string.endIndex

        }
        
        switch state {
        case .Initial:
            if filterExpressionStack.isEmpty {
                state = .Empty
            } else {
                state = .Error("Missing `)` character at index \(distance(string.startIndex, string.endIndex))")
            }
        case .LeadingDot:
            if filterExpressionStack.isEmpty {
                state = .Valid(expression: currentExpression!)
            } else {
                state = .Error("Missing `)` character at index \(distance(string.startIndex, string.endIndex))")
            }
        case .Identifier(start: let identifierStart):
            let identifier = string.substringFromIndex(identifierStart)
            if currentExpression != nil {
                currentExpression = Expression.scoped(baseExpression: currentExpression!, identifier: identifier)
            } else {
                currentExpression = Expression.identifier(identifier)
            }
            if filterExpressionStack.isEmpty {
                state = .Valid(expression: currentExpression!)
            } else {
                state = .Error("Missing `)` character at index \(distance(string.startIndex, string.endIndex))")
            }
        case .WaitingForIdentifier:
            state = .Error("Missing identifier at index \(distance(string.startIndex, string.endIndex))")
        case .IdentifierDone:
            if filterExpressionStack.isEmpty {
                state = .Valid(expression: currentExpression!)
            } else {
                state = .Error("Missing `)` character at index \(distance(string.startIndex, string.endIndex))")
            }
        case .FilterDone:
            if filterExpressionStack.isEmpty {
                state = .Valid(expression: currentExpression!)
            } else {
                state = .Error("Missing `)` character at index \(distance(string.startIndex, string.endIndex))")
            }
        case .Error:
            break
        default:

            switch state {
            case .Error:
                break stringLoop
                
            case .WaitingForAnyExpression:
                switch c {
                case " ", "\r", "\n", "\r\n", "\t":
                    break
                case ".":
                    state = .LeadingDot
                case "(":
                    state = .Error("Unexpected character `\(c)` at index \(distance(string.startIndex, i))")
                case ")":
