Пример #1
0
        public override int VisitLog_arit([NotNull] CoolParser.Log_aritContext context)
        {
            int s = Visit(context.expr());

            if (context.op.Type == CoolLexer.SUB)
            {
                return(-s);
            }
            return(~s);
        }
Пример #2
0
        public override AST_Node VisitLog_arit([NotNull] CoolParser.Log_aritContext context)
        {
            AST_Expresion l = (AST_Expresion)Visit(context.expr());

            return(new AST_UnaryOp(context, l, context.op));
        }