예제 #1
0
        public ParseDelegate CompileImplementation(Runtime runtime,
                                                   StateForCompiler state)
        {
            ParserBlock block = new ParserBlock();

            block.Emit(CompileNew(runtime, state));
            block.Return();

            DynamicMethod implementation = new DynamicMethod(
                "parse" + type.Name,
                typeof(ParseTree),
                new Type[] { typeof(Lexer), typeof(ParserState) },
                runtime.CompilerModule.ModuleBuilder);

            block.Build(new DynamicMethodProxy(implementation));

            return((ParseDelegate)implementation.CreateDelegate(typeof(ParseDelegate)));
        }