How can I control what variables are in scope

Hi I am writing a Domain Specific Language and want to check that an Expr is formatted correctly.
I have been trying to use eval(ex). But this evaluates the expression with access to variables in global scope.
Is there a way to: (a) list the variables in global scope so that I can clear them?
(b) clear all variables from global scope?
(c) evaluate an expression with restricted scope?
I may have missed something obvious , like going about this in the wrong way, so any pointers very much appreciated. david

I could preprocess variable names and that way fake variable scope but this seems like an ugly solution.

How about

Module Emptymod

expr = ...

(Untested, sent from phone)

Thanks Peter nice try but
module EmptyMod
xex = 2;
evaluates to 3

I will explore the idea EmptyMod.eval not thought of this before.

module EmptyMod
function runClean(ex)
go = eval(ex)
println("runClean ",go)
return go
x = 22;
sol = EmptyMod.runClean(:(1+x));
is most of the way there! thanks again

Still not working as Julia no longer supports clear!(:x). The only way I can see is to use JuMp as they also need to add and delete variables. This seems like a some what heavy handed use of JuMP as my first step is to visualise Symbolic Petri Nets only then will I be considering JuMP style constaint solving. So have I missed something or is evaluating Expr in a controlled environment just hard? any ideas much appreciated.

Looks like the whole eval approach is now obsolete! and best practice is to use Modia @model.
So I will start again. david