1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/usr/bin/python
import sys
from front import ast
#import SymbolTable
from back import tac
def main():
mUn = ast.UnaryExpression("PLUS","a")
mIf = ast.IfStatement(mUn,"true","false")
mFunc1 = ast.Function("func1",["param1","param2"],mIf)
mFunc2 = ast.Function("func2",["param0","param1"],mIf)
mProg = ast.Program([mFunc1,mFunc2])
Test()
class Test:
def __init__(self):
x = tac.TacElem("PLUS",3,5)
y = tac.TacElem("MINUS",8,3)
z = tac.TacArray()
z.append(x)
z.append(y)
z.createList()
if __name__ == "__main__":
sys.exit(main())
|