Ejemplo n.º 1
0
        public static Tree Compiler(System sys, string s, Kind traitAs)
        {
            var e = new Compile(s, traitAs)
            {
                System = sys
            };

            if (e.Excecute())
            {
                return(e.Root.Children[0]);
            }
            return(null);
        }
Ejemplo n.º 2
0
 public System(Compile compile, Symentic symentic, Lexical lexical, Parser parser, TypeCalc typeCalc, Assembly assembly, Component mrt)
 {
     Compile         = compile;
     Symentic        = symentic;
     Lexical         = lexical;
     Parser          = parser;
     this.TypeCalc   = typeCalc;
     compile.System  = this;
     symentic.System = this;
     lexical.System  = this;
     parser.System   = this;
     typeCalc.System = this;
     this.Assembly   = assembly;
 }
Ejemplo n.º 3
0
        internal void Constructor(IList <Tree> trees)
        {
            Labels.Reset();
            System.Lexical.OpenMethod(trees[0].Content, trees[0].Content, trees[1].Children);
            VM.Parser.Instruct.Parse(Const.nop).Push(System.Lexical.StreamWriter);
            this.System.Lexical.EPSInc = System.Lexical.StreamWriter.Offset;
            Insert(Const.add, null, new Tree("esp", Kind.Register), new Tree(System.Lexical.CurrentMethod.DataSize.ToString(), Kind.Numbre));
            //Inset(Const.add, new Operand(VM.Bases.OperandType.Reg, "esp"), new Operand(Kind.Numbre, System.Lexical.CurrentMethod.DataSize));
            for (var j = trees[1].Children.Count - 1; j >= 0; j--)
            {
                Insert(Const.pop, Const.empty, trees[1].Children[j].Children[1]);
            }
            Compiler(trees[2]);
            Insert(Const.label, Const.returnLabel, new Tree(Const.returnLabel, Kind.Label));
            Insert(Const.sub, null, new Tree("esp", Kind.Register), new Tree(System.Lexical.CurrentMethod.DataSize.ToString(), Kind.Numbre));

            var a = Compile.Compiler(System, "System.new", Kind.Hyratachy); a.Type = System.Assembly.GetType("System.int");

            //Caller(new List<Tree>() { a, new Tree("()", Kind.Param) }, Kind.Caller);

            VM.Parser.Instruct.Parse(Const.ret).Push(System.Lexical.StreamWriter);
            VM.Parser.Instruct.Parse(Const.rop).Push(System.Lexical.StreamWriter);
            System.Lexical.CloseFunction();
        }