@Override public final void exitFunctionType(TypeParser.FunctionTypeContext ctx) { Type[] params = this.popParams(); this.addParam( Type.fun( params[0], params[1])); // We can do this because the grammer makes sure that a function // always has two arguments. }
@Override public final void exitTypeConstructor(TypeParser.TypeConstructorContext ctx) { this.addParam(Type.con(ctx.getText())); }
@Override public final void exitListType(TypeParser.ListTypeContext ctx) { this.addParam(Type.listOf((this.popParams()[0]))); }
@Override public final void exitTupleType(TypeParser.TupleTypeContext ctx) { this.addParam(Type.tupleOf(this.popParams())); }
@Override public void exitAppliedType(TypeParser.AppliedTypeContext ctx) { Type[] types = this.popParams(); this.addParam(Type.app(types)); }
@Override public final void exitConstantType(TypeParser.ConstantTypeContext ctx) { Type[] types = this.popParams(); this.addParam(Type.app(types)); }