Esempio n. 1
0
        public override Node VisitParenExprs([NotNull] TigerParser.ParenExprsContext context)
        {
            var node = new ExpressionSeqNode(context);

            node.Children.AddRange(from e in context.expr() select Visit(e)); // EXPRESSION+
            return(node);
        }
Esempio 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);
        }