GetGlobalSymbolCount() public static method

public static GetGlobalSymbolCount ( ) : int
return int
コード例 #1
0
        public object Interpret(object exp)
        {
            IASTNode node = ASTCompiler.Compile(null, ListProcess.TransformLibraryForms(exp));

            ReserveGlobalVaraible(SymbolTable.GetGlobalSymbolCount());
            ASTNode_Lambda lambdaNode = new ASTNode_Lambda {
                bodyNode    = node, bodyFreeAddresses = new List <FreeAddress>(), childrenFreeAddresses = new List <FreeAddress>(),
                formalCount = 0, locals = new List <string>(),
            };

            var fileName        = "____test.exe";
            var assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(
                new AssemblyName(GenernateUniqueString("assemly")), AssemblyBuilderAccess.RunAndSave);
            var moduleBuilder  = assemblyBuilder.DefineDynamicModule(GenernateUniqueString("module"), fileName, HasSymbolInfo());
            var envTypeBuilder = moduleBuilder.DefineType(GenernateUniqueString("class"));

            var methodBuilder = new ASTNodeVisitor_JITCompiler(null, envTypeBuilder, lambdaNode).MethodBuilder;

            var type = envTypeBuilder.CreateType();

            assemblyBuilder.SetEntryPoint(methodBuilder, PEFileKinds.ConsoleApplication);
            // assemblyBuilder.Save(fileName);

            return(((Func <object>)type.GetMethod(methodBuilder.Name).CreateDelegate(typeof(Func <object>)))());
        }
コード例 #2
0
        public object Interpret(object exp)
        {
            IASTNode node = ASTCompiler.Compile(null, ListProcess.TransformLibraryForms(exp));

            Env.ReserveGlobalVariables(SymbolTable.GetGlobalSymbolCount());

            return(new ASTNodeVisitor_Interpreter(null, node).Value);
        }