public override void Visit(SystemOutPrintLnStatementNode node)
 {
     node.expression.Accept(this);
     Gen("push", "ecx");
     Gen("push", "eax");
     Gen("call", "put", "", "Calling System.Out.Println()");
     Gen("add", "sp","4");
     Gen("pop", "ecx");
 }
        public override void Visit(SystemOutPrintLnStatementNode node)
        {
            try
            {
                node.expression.Accept(this);

                if (!AreTypeCompatible(node.expression.ExpressionType.GetType(), typeof(IntType)))
                    throw new Exception("Expression for System.out.println is not of type Int!");
            }
            catch (Exception e)
            {
                Analysis.LogSemanticError(e.Message, node.lineNumber);
            }
        }
Exemple #3
0
 public virtual void Visit(SystemOutPrintLnStatementNode node)
 {
     node.expression.Accept(this);
 }
 public override void Visit(SystemOutPrintLnStatementNode node)
 {
     Console.WriteLine(this.indentation + "System.Out.Println           ---- Statement ----");
     indentation = indentation + "   ";
     node.expression.Accept(this);
     indentation = indentation.Substring(0, indentation.Length - 3);
 }