Exemplo n.º 1
0
        internal static string OneStep(Nodes.Statement currStatement)
        {
            string result = null;
            if (currStatement is Nodes.Print)
            {
                result = currStatement.Interpreter().StringValue;

            }
            else
                currStatement.Interpreter();
            currStatement = currStatement.Next;
            return result;
        }
Exemplo n.º 2
0
 private static List<string> RunProgram(Nodes.Statement firstStatement)
 {
     List<string> result = new List<string>();
     while (firstStatement != null)
     {
         if (firstStatement is Nodes.Assignment || firstStatement is Nodes.End || firstStatement is Nodes.GoTo ||
             firstStatement is Nodes.Condition)
             firstStatement.Interpreter();
         if (firstStatement is Nodes.Print)
         {
             Nodes.Variable.Value forPrint = firstStatement.Interpreter();
             if (forPrint.Type == Nodes.Variable.VarType.String)
                 result.Add(forPrint.StringValue);
             else
                 result.Add(forPrint.FloatValue.ToString());
         }
         firstStatement = firstStatement.Next;
     }
     return result;
 }