How to automate a laborous task (via Metaprogramming? Need to access variables of the current working space)

If I try to implement something like compute(::ComputationType1, expr), I would call it via
compute(ComputationType1(), :(x_1*x_2+z*inv(x_3))), right? (Or do you have something else in mind?)

The function definition would look something like

function compute(::ComputationType1, expr::Expr)
    A = nothing
    for x in expr.args
        ex = eval(x)
        if typeof(ex) <: CrystalOperator
            A = lcm(A, ex.C.L.A)
        end
    end
    return A
end

However, I do get an “UndefVarError: x_1 not defined”-error. How can I access the variable of the current working space?