public void run(NodeLinkedList list)
        {
            Console.WriteLine("<------ Virtual Machine ------>");
            Console.WriteLine("");
            _commands = new Dictionary<string, BaseCommand>();
            Variables = new Dictionary<string, Variable>();
            ReturnVariable = new Variable();

            initialiseCommands();

            Node currentNode = list.getFirst();
            NextNodeVisitor visitor = new NextNodeVisitor(this);

            while (currentNode != null)
            {
                AbstractFunctionCall actionNode = currentNode as AbstractFunctionCall;

                if (actionNode != null)
                {
                    string name = actionNode.parameters[0];
                    _commands[name].execute(this, actionNode.parameters);
                }

                // Bepaal de volgende node:
                currentNode.accept(visitor);
                currentNode = visitor.nextNode;
            }
            Console.WriteLine("");
            Console.WriteLine("<------ Einde programma ------>");
            Console.WriteLine("");
        }
 public void setVariable(string key, Variable variable)
 {
     if (!Variables.ContainsKey(key))
         Variables.Add(key, variable);
     else
         Variables[key] = variable;
 }
 public Variable clone()
 {
     Variable newVar = new Variable();
     newVar.value = value;
     newVar.tokenType = tokenType;
     return newVar;
 }