public override void ExitNotexp1(ssuplParser.Notexp1Context context) { //notexp : NOT notexp code.Put(context, code.Get(context.notexp()), //second term "pop rax", //result of second term "cmp rax,0", //see if it's zero "sete al", //if not, set al to 1 "movzx qword rax,al", //zero extend "push rax" //push result ); }
public override void ExitNotexp1(ssuplParser.Notexp1Context context) { //notexp : NOT notexp if (type(context.notexp()) != VarType.INT) { throw new Exception("First operand to OR must be integer"); } typeAttr.Put(context, VarType.INT); code.Put(context, code.Get(context.notexp()), //second term "pop rax", //result of second term "cmp rax,0", //see if it's zero "sete al", //if not, set al to 1 "movzx qword rax,al", //zero extend "push rax" //push result ); }
/// <summary> /// Exit a parse tree produced by the <c>notexp1</c> /// labeled alternative in <see cref="ssuplParser.notexp"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitNotexp1([NotNull] ssuplParser.Notexp1Context context) { }