public override bool Visit(AstWhileStatement node)
 {
     ErrorIfIsNull(node.Condition);
     ErrorIfIsNull(node.Statements);
     return true;
 }
 public override bool Visit(AstWhileStatement node)
 {
     return true;
 }
예제 #3
0
 public override bool Visit(AstWhileStatement node)
 {
     string currWhileIndex = CreateWhileUse().ToString(); ;
     codeStream.WriteLine("br label %whilecond" + currWhileIndex);
     codeStream.WriteLine("whilestart" + currWhileIndex + ":");
     node.Statements.Accept(this);
     codeStream.WriteLine("br label %whilecond" + currWhileIndex);
     codeStream.WriteLine("whilecond" + currWhileIndex + ":");
     node.Condition.Accept(this);
     var condExprResult = GetCurrUnnamedVariable();
     codeStream.WriteLine(CreateUnnamedVariable() + " = icmp eq i1 1, " + condExprResult);
     codeStream.WriteLine("br i1 " + GetCurrUnnamedVariable() + ", label %whilestart" + currWhileIndex + ", label %endwhile" + currWhileIndex);
     codeStream.WriteLine("endwhile" + currWhileIndex + ":");
     //codeStream
     return false;
 }
예제 #4
0
        // #WHILE_STATEMENT WHILE LEFT_PAREN #OR_TEST RIGHT_PAREN BLOCK_START #STATEMENTS_BLOCK BLOCK_END
        private void ConstructWhileStatement()
        {
            var block = nodes.Pop() as AstStatementsBlock;
            var condition = nodes.Pop() as AstExpression;

            var stmt = new AstWhileStatement(condition, block);
            PushNode(stmt);
        }
예제 #5
0
 public abstract bool Visit(AstWhileStatement node);