示例#1
0
        public void CompilationTest()
        {
            var elfCode = ResourceHelper.ReadFromResource("Elf.Playground.Staple.Universal.elf");
            var elfAst = new ElfAstBuilder(elfCode).BuildAst();

            var evis = new DefaultElfCompiler().Compile((FuncDef)elfAst.Children.ElementAt(0).Children.ElementAt(1));

            var pewpew = evis.Select(evi => evi.ToString()).StringJoin(Environment.NewLine);
            AssertHelper.AreEqualFromResource("Elf.Playground.Staple.VirtualMachineTests.Compilation", pewpew, @"d:\elf-vmcompile");
        }
示例#2
0
        public void TestEviBindings()
        {
            var elfCode = ResourceHelper.ReadFromResource("Elf.Playground.Staple.Universal.elf");
            var elfAst = new ElfAstBuilder(elfCode).BuildAst();

            var evis = new DefaultElfCompiler().Compile((FuncDef)elfAst.Children.ElementAt(0).Children.ElementAt(1));
            evis.ForEach((evi, i) => Assert.IsNotNull(evi.AstNode, i + ": " + evi));

            var pewpew = evis.Select(evi => String.Format("{0} -> {1}", evi, evi.AstNode.FullTPath));
            var pepew = pewpew.StringJoin(Environment.NewLine);
            AssertHelper.AreEqualFromResource("Elf.Playground.Staple.DebugInfoTests.EviBindings", pepew, @"d:\elf-elfastbind");
        }
示例#3
0
        public VirtualMachine()
        {
            Classes = new List<ElfClass>();
            Context = new Dictionary<String, Object>();
            Threads = new List<IElfThread>();

            Deserializers = new Dictionary<String, Func<String, IElfObject>>();
            HelperMethods = new List<ClrMethod>();

            Loader = new DefaultVmLoader();
            Loader.Bind(this);

            Compiler = new DefaultElfCompiler();
            Compiler.Bind(this);

            Marshaller = new DefaultElfObjectMarshaller();
            Marshaller.Bind(this);
        }