蟒蛇2.6.7;Windows 7的
在 python 中解决 Deitel 的“简单编译器”练习。github 上的存储库。编写测试套件。
module compiler.py
class SCompiler( object ) :
RAMSIZE = 100
# more static attributes
def __init__( self ) :
self.symbolTable = [ TableEntry( ) ] * SCompiler.RAMSIZE
self.lineFlags[ -1 ] * SCompiler.RAMSIZE
# more initializations
堆栈跟踪。
File "testCompiler.py", line 45, in <module>
tool = compiler.SCompiler( )
File "absolutePath\compiler.py", line 37, in `__init__`
self.lineFlags[ -1 ] * SCompiler.RAMSIZE
AttributeError: 'SCompiler' object has no attribute 'lineFlags'
我不确定这里有什么拼写错误。文件“compiler.py”文件以静默方式编译。TableEntry 是文件中的另一个类。谢谢你的建议。