public InfixNode(CoolParser.InfixExpContext context, Node s) : base(s.Childs) { this.context = context; this.s = s; this.OP = context.op.Text; this.LE = s.Childs[0]; this.RE = s.Childs[1]; }
public override bool VisitInfixExp([NotNull] CoolParser.InfixExpContext context) { var s1 = context.le.getCoolType(); var s2 = context.re.getCoolType(); if (s1 == s2) { return(VisitChildren(context)); } else { return(true); } return(VisitChildren(context)); }
public override object VisitInfixExp([NotNull] CoolParser.InfixExpContext context) { Expression left = (Expression)Visit(context.expresion()[0]); Expression right = (Expression)Visit(context.expresion()[1]); if (context.PLUS() != null) { return(new BinArithExp(left, right, Op.plus, GetCoord(context))); } else if (context.MINUS() != null) { return(new BinArithExp(left, right, Op.minus, GetCoord(context))); } else if (context.STAR() != null) { return(new BinArithExp(left, right, Op.times, GetCoord(context))); } else if (context.SLASH() != null) { return(new BinArithExp(left, right, Op.div, GetCoord(context))); } return(new BinArithExp(left, right, Op.unknown, GetCoord(context))); }
public override Node VisitInfixExp([NotNull] CoolParser.InfixExpContext context) { var s = VisitChildren(context); return(new InfixNode(context, s)); }
public override object VisitInfixExp([NotNull] CoolParser.InfixExpContext context) { VisitExpr(context); return(VisitChildren(context)); }
/// <summary> /// Exit a parse tree produced by the <c>infixExp</c> /// labeled alternative in <see cref="CoolParser.expresion"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitInfixExp([NotNull] CoolParser.InfixExpContext context) { }
/// <summary> /// Visit a parse tree produced by the <c>infixExp</c> /// labeled alternative in <see cref="CoolParser.expresion"/>. /// <para> /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/> /// on <paramref name="context"/>. /// </para> /// </summary> /// <param name="context">The parse tree.</param> /// <return>The visitor result.</return> public virtual Result VisitInfixExp([NotNull] CoolParser.InfixExpContext context) { return(VisitChildren(context)); }
public static string getCoolType(this CoolParser.InfixExpContext s) { return("INT"); }