Exemplo n.º 1
0
        public override dynamic Visit(DeclarationListNode node)
        {
            node.Left.Accept(this);
            node.Right.Accept(this);

            return(null);
        }
Exemplo n.º 2
0
        public override Node VisitLet([NotNull] TigerParser.LetContext context)
        {
            var node = new LetNode(context);

            TigerParser.DeclsContext[] decls = context.decls();
            var declarations = new DeclarationListNode(decls[0]);

            declarations.Children.AddRange(from d in decls select Visit(d)); // declaration list -> DECLARATION+
            node.Children.Add(declarations);                                 // DECLARATION LIST

            TigerParser.ExprContext[] exprs = context.expr();

            ExpressionSeqNode expressions;

            if (exprs.Length > 0)
            {
                expressions = new ExpressionSeqNode(exprs[0]);
            }
            else
            {
                expressions = new ExpressionSeqNode(-1, -1);
            }

            expressions.Children.AddRange(from e in exprs select Visit(e)); // expression sequence -> EXPRESSION*
            node.Children.Add(expressions);                                 // EXPRESSION SEQUENCE

            return(node);
        }
Exemplo n.º 3
0
        public override dynamic Visit(DeclarationListNode node)
        {
            var statements = FlattenBranchNode(node);

            foreach (var statement in statements)
            {
                statement.Accept(this);
            }

            return(null);
        }
Exemplo n.º 4
0
 public abstract dynamic Visit(DeclarationListNode node);