class Absyn:
def __init__(self, outputfn):
- self.outputfile = open(outputfn, "w")
- self.outputfile.write(preamble)
+ self.outputfn = outputfn
+ self.outputfile = None
self.assign = []
self.ports = []
+ def open(self):
+ if(self.outputfile is None):
+ self.outputfile = open(self.outputfn, "w")
+ self.outputfile.write(preamble)
+
def printpy(self, p):
+ self.open()
self.outputfile.write(str(p)+"\n")
def assign(self, p):
return clsdecl
def appendComments(self, data):
+ self.open()
self.outputfile.write(data)
#lines = data.split("\n")
# for line in lines: