根据测试木兰的行为,大致进行了对木兰到 python 的代码生成器的开发。
由于我个人能提供的测试用例有限,恳请您能够进行进一步的测试。

想要进行木兰到 Python 的操作,可以加入 --dump-python 参数。
例如测试文件 test/test_codegen.ul

type Animal {

  func $Animal() {
    println(1)
  }

  func $run(n) {
    println(n)
  }
}


type WildAnimal {

  func $WildAnimal(name) {
    println(name)
  }
}


type Person : Animal {

  func $Person() {
    super()
  }

  func $go() {
    super.run(3)
  }
}


type Wolf : WildAnimal {

  func $Wolf() {
    super(2)
  }
}
Person()
Wolf()
Person().go()
$ python3 -m 木兰 --dump-python test/test_codegen.ul
import sys
from math import *
ARGV = sys.argv[1:]
class Animal:

    def __init__(self):
        print(1)

    def run(self, n):
        print(n)


class WildAnimal:

    def __init__(self, name):
        print(name)


class Person(Animal):

    def __init__(self):
        super().__init__()

    def go(self):
        super().run(3)


class Wolf(WildAnimal):

    def __init__(self):
        super().__init__(2)
Person()
Wolf()
Person().go()