public Compiler()
        {
            engine = new ScriptEngine("jscript");

            var underscore = LoadResource("underscore.js") + LoadResource("underscore.compile.js");
            vm = engine.Parse(underscore);
        }
        private object Parse(string text, bool expression)
        {
            const string varName = "x___";
            object result;

            engine.SetScriptState(ScriptState.Connected);

            var flags = ScriptText.None;
            if (expression)
            {
                flags |= ScriptText.IsExpression;
            }

            try
            {
                // immediate expression computation seems to work only for 64-bit
                // so hack something for 32-bit...
                System.Runtime.InteropServices.ComTypes.EXCEPINFO exceptionInfo;
                if (parse32 != null)
                {
                    if (expression)
                    {
                        // should work for jscript & vbscript at least...
                        text = varName + "=" + text;
                    }
                    parse32.ParseScriptText(text, null, null, null, IntPtr.Zero, 0, flags, out result, out exceptionInfo);
                }
                else
                {
                    parse64.ParseScriptText(text, null, null, null, IntPtr.Zero, 0, flags, out result, out exceptionInfo);
                }
            }
            catch
            {
                if (Site.LastException != null)
                    throw Site.LastException;

                throw;
            }

            IntPtr dispatch;
            if (expression)
            {
                // continue  out 32-bit hack...
                if (parse32 != null)
                {
                    engine.GetScriptDispatch(null, out dispatch);
                    object dp = Marshal.GetObjectForIUnknown(dispatch);
                    try
                    {
                        return dp.GetType().InvokeMember(varName, BindingFlags.GetProperty, null, dp, null);
                    }
                    catch
                    {
                        if (Site.LastException != null)
                            throw Site.LastException;

                        throw;
                    }
                }
                return result;
            }

            engine.GetScriptDispatch(null, out dispatch);
            var parsed = new ParsedScript(this, dispatch);
            return parsed;
        }