Source

BrainMachine / Main.py

Full commit
#!/usr/bin/env python
import LangDef
import MainBrain

src = '''
class C():
    def __init__(self):
        self.a = 1
    def __getattr__(self, name):
        if name == 'b':
            return 2
        return 'unknown'

the = C()
print the.a - (5-2), the.b + 3 * 4, the.c + 's'
'''

mb = MainBrain.MainBrain()
MainBrain.g_mb = mb
mb.DefineInLang(LangDef.python)
mb.ReadInBuf(src)
for s in mb.Output():
    print s
print '-----------------'
mb.DefineOutLang(LangDef.python_without_dyna)
for s in mb.OutputCpp():
    print s
print '-----------------'
mb.Run()