     @visitLiteral node
   visitParens: (node) ->
     node.formula.visit @
+  visitInfixExpression: (node, fn) ->
+    left = node.left.visit @
+    right = node.right.visit @
+    fn left, right
 
 class Evaluator extends FormulaVisitor
   constructor: (@data) ->

  constructor: ->
  visitLiteral: ->
    []

  visitReference: (node) ->
    [node.name]
  visitComparison: (node) ->
    refs = []
    for ref in node.left.visit @
      refs.push ref if -1 is refs.indexOf ref
    for ref in node.right.visit @
      refs.push ref if -1 is refs.indexOf ref
    refs

evaluate = (f, data) ->
  f.visit new Evaluator data

  visitReference: (node) ->
    @data[node.name]
  visitComparison: (node) ->
    @visitInfixExpression node, getComparator node.comparator

getComparator = (comparator) ->
  switch comparator
