def visitFuncdecl(self,ctx:MPParser.FuncdeclContext): local,cpstmt = self.visit(ctx.body()) return FuncDecl(Id(ctx.ID().getText()), [], local, cpstmt, self.visit(ctx.mtype()))
def visitFuncdecl(self, ctx: MPParser.FuncdeclContext): rtype = self.visit(ctx.idtype()) cpstmt = self.visit(ctx.body()) return FuncDecl(Id(ctx.ID().getText()), self.visit(ctx.plist()) if ctx.plist() else [], self.visit(ctx.vardecl()) if ctx.vardecl() else [], cpstmt, rtype)
def visitFuncdecl(self, ctx: MPParser.FuncdeclContext): id = Id(ctx.ID().getText()) param = self.visit(ctx.paramdecl()) if ctx.paramdecl() else [] mptype = self.visit(ctx.mptype()) var = self.visit(ctx.vardecl()) if ctx.vardecl() else [] body = flatten([self.visit(ctx.compoundstm())]) return [FuncDecl(id, param, var, body, mptype)]
def visitFuncdecl(self, ctx: MPParser.FuncdeclContext): return 7 + self.visit(ctx.mtype()) + self.visit(ctx.body())
def visitFuncdecl(self, ctx: MPParser.FuncdeclContext): local, cpstmt = self.visit( ctx.vardecl()) if ctx.vardecl() else [], self.visit( ctx.compoundstatement()) return FuncDecl(Id(ctx.ID().getText()), self.visit(ctx.pardec()), local, cpstmt, self.visit(ctx.mtype()))