progs/fun.scala
changeset 669 2f5a4d76756d
parent 649 e83afb44f276
child 695 484b74bc057e
equal deleted inserted replaced
668:9ce78065f68d 669:2f5a4d76756d
   152 def compile_decl(d: Decl) : String = d match {
   152 def compile_decl(d: Decl) : String = d match {
   153   case Def(name, args, a) => { 
   153   case Def(name, args, a) => { 
   154     val env = args.zipWithIndex.toMap
   154     val env = args.zipWithIndex.toMap
   155     val is = "I" * args.length
   155     val is = "I" * args.length
   156     m".method public static $name($is)I" ++
   156     m".method public static $name($is)I" ++
   157     m".limit locals ${args.length.toString}" ++
   157     m".limit locals ${args.length}" ++
   158     m".limit stack ${1 + max_stack_exp(a)}" ++
   158     m".limit stack ${1 + max_stack_exp(a)}" ++
   159     l"${name}_Start" ++   
   159     l"${name}_Start" ++   
   160     compile_exp(a, env) ++
   160     compile_exp(a, env) ++
   161     i"ireturn" ++
   161     i"ireturn" ++
   162     m".end method\n"
   162     m".end method\n"