A version that produces an AST instead of evaluates is here. More about the library is at my weblog post. Source for this example is in example3.js.