Пример #1
0
        public override object VisitFactor([NotNull] CMinusParser.FactorContext context)
        {
            if (context.NUM() != null)
            {
                this.writer.WriteImmediate(context.NUM().GetText());
            }
            else
            {
                base.VisitFactor(context);
            }

            return(null);
        }
Пример #2
0
        public override object VisitFactor([NotNull] CMinusParser.FactorContext context)
        {
            if (context.accessVariable() != null)
            {
                this.writer.WriteLoadVariable(context.accessVariable().GetText());
            }

            if (context.NUM() != null)
            {
                this.writer.WritePush(int.Parse(context.NUM().GetText()));
            }

            return(base.VisitFactor(context));
        }