def __repr__(self): s = 'If(' + repr(self.condition) + ') ' if len(self.stlist1) != 0: s += '{\n' + inc_tabsize('\n'.join( [repr(st) for st in self.stlist1])) + '\n}' if len(self.stlist2) != 0: s += '\nelse {\n' + inc_tabsize('\n'.join( [repr(st) for st in self.stlist2])) + '\n}' return s
def __str__(self): inner = '%s\n' % str(self.condition) if len(self.stlist) != 0: inner += ',\n' inner += str(self.stlist) return 'WHILE\n(\n%s\n)' % inc_tabsize(inner)
def __repr__(self): if self.declaration: return 'Func %s(%s) -> %s' % (repr(self.fname), str( self.params), str(self.rtype)) else: return 'Func %s(%s) -> %s {\n%s\n}' % ( repr(self.fname), str(self.params), str(self.rtype), inc_tabsize('\n'.join([repr(st) for st in self.stlist])))
def __str__(self): inner = '%s\n' % str(self.condition) if len(self.stlist1) != 0: inner += ',\n' inner += str(self.stlist1) if len(self.stlist2) != 0: inner += '\n,\n' inner += str(self.stlist2) return 'IF\n(\n%s\n)' % inc_tabsize(inner)
def __str__(self): if not self.declaration: s = '%s\n%s' % (( ('%s\nPARAMS %s\nRETURNS %s' % ('Function Main' if self.fname == 'main' else 'FUNCTION ' + self.fname, symbol_list_as_dict(self.params), str( self.rtype)))), '\n'.join([ str(stmt) if isinstance(stmt, Return) else inc_tabsize(str(stmt)) for stmt in self.stlist ])) return s else: return ''
def __repr__(self): return 'Program {\n%s\n}' % inc_tabsize('\n'.join( [repr(func) for func in self.global_list]))
def __str__(self): s = "%s\n(\n%s\n)" % (self.operator, inc_tabsize(str(self.operand))) return s
def __str__(self): inner = str(self.ast) return 'RETURN\n(\n%s\n)' % inc_tabsize(inner)
def __repr__(self): s = 'While(' + repr(self.condition) + ') ' if len(self.stlist) != 0: s += '{\n' + inc_tabsize('\n'.join( [repr(st) for st in self.stlist])) + '\n}' return s
def __str__(self): return 'CALL %s\n(\n%s\n)\n' % (self.fname, inc_tabsize('\n,\n'.join([ '%s' % str(param) for param in self.params ])))