 
 func makeArithmeticParser() -> ParserProtocol {
 
-    let space = " \t".match
+    let space = " ".match
     let skip = space.some.maybe
     let digit = (0...9).match
-    let op = "+-*/".match.tag("op") >>> skip
+    let op = "+-*".match.tag("op") >>> skip
     let numeral = skip >>> digit.some.tag("numeral") >>> skip
     let expression = Deferred()
-    let compound = numeral.tag("first") >>> op >>> expression.tag("second")
+    let compound = op >>> expression.tag("first") >>> expression.tag("second")
     expression.parser = compound | numeral
     return expression
 }

        return ArithmeticConstant(value: int)
    }
    
    transformer.transform(["first": .simple("first"),
                           "second": .simple("second"),
                           "op": .literal("+")]
    ) { args in
        ArithmeticOperation(first: try args.transformed("first"), second: try args.transformed("second"), function: { a, b in a + b })
    }
    
    transformer.transform(["first": .simple("first"),
                           "second": .simple("second"),
                           "op": .literal("-")]
    ) { args in
        ArithmeticOperation(first: try args.transformed("first"), second: try args.transformed("second"), function: { a, b in a - b })
    }
    
    transformer.transform(["first": .simple("first"),
                           "second": .simple("second"),
                           "op": .literal("*")]
    ) { args in
        ArithmeticOperation(first: try args.transformed("first"), second: try args.transformed("second"), function: { a, b in a * b })
    }
    
    transformer.transform(["first": .simple("first"),
                           "second": .simple("second"),
                           "op": .literal("/")]
    ) { args in
        ArithmeticOperation(first: try args.transformed("first"), second: try args.transformed("second"), function: { a, b in a / b })
    }
    
    return transformer


func runArithmetic() {
    do {
        let polishNotationInput = "+ 3 - * 8 5 9"
        print("\(polishNotationInput)\n")
        let intermediateSyntaxTree = makeArithmeticParser().parse(polishNotationInput)
        print("\(intermediateSyntaxTree)\n")
        let abstractSyntaxTree = try makeArithmeticTransformer().transform(intermediateSyntaxTree)
        print("\(abstractSyntaxTree)\n")
        let result = abstractSyntaxTree.evaluate()
        print("\(polishNotationInput) = \(result)")
    } catch {
        print(error)
    }
