'Compile the expression to a list of Python AST expressions, a
set of variable names used, and a set of function names.'

def translate(self):

    expressions = []
    varnames = set()
    funcnames = set()
    for part in self.parts:
        if isinstance(part, six.string_types):
            expressions.append(ex_literal(part))
        else:
            (e, v, f) = part.translate()
            expressions.extend(e)
            varnames.update(v)
            funcnames.update(f)
    return (expressions, varnames, funcnames)
