Beispiel #1
0
        public string Visit(AST_While node)
        {
            var whil = methodcontext.GenLabel("while");
            var s    = methodcontext.GenLocal("resultwhile", true);

            var dowhile  = methodcontext.GenLabel("dowhile");
            var endwhile = methodcontext.GenLabel("endwhile");

            methodcontext.Staments.Add(new CIL_Label(whil));
            var x = node.Cond.Visit(this);

            methodcontext.Staments.Add(new CIL_If_Goto(x, dowhile));
            methodcontext.Staments.Add(new CIL_Goto(endwhile));
            methodcontext.Staments.Add(new CIL_Label(dowhile));

            var y = node.WhileCorpus.Visit(this);

            methodcontext.Staments.Add(new CIL_Asig(s, y, "var"));

            methodcontext.Staments.Add(new CIL_Goto(whil));

            methodcontext.Staments.Add(new CIL_Label(endwhile));

            return(s);
        }
        public bool Visit(AST_While node)
        {
            bool visit_result = true;

            foreach (var child in node.Children)
            {
                visit_result &= child.Visit(this);
            }
            return(visit_result);
        }
Beispiel #3
0
        public Base_Object_Value Visit(AST_While node)
        {
            Base_Object_Value t = node.Cond.Visit(this);
            Base_Object_Value s = Type_OBJECT.Singleton().Instanciate();

            while (t.IsTrue())
            {
                s = node.WhileCorpus.Visit(this);
                t = node.Cond.Visit(this);
            }
            return(s);
        }
Beispiel #4
0
        public bool Visit(AST_While node)
        {
            bool solve = true;

            if (!node.Cond.Visit(this))
            {
                return(false);
            }
            if (!node.WhileCorpus.Visit(this))
            {
                return(false);
            }
            node.MyType = All_Types["Object"];

            return(solve);
        }
Beispiel #5
0
 public bool Visit(AST_While node)
 {
     return(node.Cond.Visit(this) && node.WhileCorpus.Visit(this));
 }
Beispiel #6
0
 public bool Visit(AST_While node)
 {
     throw new NotImplementedException();
 }