Exemplo n.º 1
0
        private void checkout(AstNode theNode)
        {
            foreach (AstNode node in theNode.Children)
            {
                if (node is BinOpNode)
                {
                    BinOpNode bnode = ((BinOpNode)node);
                    if (((BinOpNode)node).BinOp == BinaryOperation.Assignment)
                    {
                        if (!result.Symbols.Contains(bnode.Left.ToString()))
                        {
                            result.Symbols.Add(bnode.Left.ToString());
                        }
                    }
                }
                else
                {
                    checkout(node);
                }
            }

            foreach (AstNode node in theNode.Children)
            {
                if (node is FuncNode)
                {
                    FuncNode fnode = ((FuncNode)node);
                    currentLocalScope = new LocalScope();
                    result.ChildScopes[fnode.Name] = currentLocalScope;
                    currentLocalScope.Symbols.AddRange(fnode.Parameters);
                    analyseLocalCode(fnode.Body);
                }
            }
        }
Exemplo n.º 2
0
        private void checkout(AstNode theNode)
        {
            foreach(AstNode node in theNode.Children)
                if (node is BinOpNode)
                {
                    BinOpNode bnode = ((BinOpNode)node);
                    if (((BinOpNode)node).BinOp == BinaryOperation.Assignment)
                    {
                        if (!result.Symbols.Contains(bnode.Left.ToString()))
                        {
                            result.Symbols.Add(bnode.Left.ToString());
                        }
                    }
                }
                else
                    checkout(node);

            foreach(AstNode node in theNode.Children)
                if (node is FuncNode)
                {
                    FuncNode fnode = ((FuncNode)node);
                    currentLocalScope = new LocalScope();
                    result.ChildScopes[fnode.Name] = currentLocalScope;
                    currentLocalScope.Symbols.AddRange(fnode.Parameters);
                    analyseLocalCode(fnode.Body);
                }
        }
Exemplo n.º 3
0
 public HassiumFunction(Interpreter interpreter, FuncNode funcNode, LocalScope localScope)
 {
     this.interpreter = interpreter;
     this.funcNode    = funcNode;
     this.localScope  = localScope;
 }
Exemplo n.º 4
0
 public HassiumFunction(Interpreter interpreter, FuncNode funcNode, LocalScope localScope)
 {
     this.interpreter = interpreter;
     this.funcNode = funcNode;
     this.localScope = localScope;
 }
Exemplo n.º 5
0
 public StackFrame(LocalScope scope)
 {
     this.Scope  = scope;
     this.Locals = new Dictionary <string, object>();
 }
Exemplo n.º 6
0
 public StackFrame(LocalScope scope)
 {
     this.Scope = scope;
     this.Locals = new Dictionary<string, object>();
 }