Exemple #1
0
 def addLabel_CASE(self, cadena, line, tab=True):
     new = Quadruple()
     elem1 = Element()
     elem1.constructor1(cadena, Element.E_LABEL)
     new.constructor_1(None, None, elem1, -1, Quadruple.T_LABEL_CASE, line,
                       tab)
     self.fuente.append(new)
Exemple #2
0
 def addGoto(self, cadena, line, tab=True):
     new = Quadruple()
     elem1 = Element()
     elem1.constructor1(cadena, Element.E_GOTO)
     new.constructor_1(None, None, elem1, -1, Quadruple.T_GOTO, line, tab)
     self.fuente.append(new)
     return len(self.fuente)
Exemple #3
0
 def addScalarAsig(self, dest, src, line, tab):
     new = Quadruple()
     elem1 = Element()
     elem1.constructor1(src, Element.E_SCALAR)
     elem2 = Element()
     elem2.constructor1(dest, Element.E_SCALAR)
     new.constructor_1(elem1, None, elem2, -1, Quadruple.T_ASIG, line, tab)
     self.fuente.append(new)
Exemple #4
0
 def addIF(self, op1, gt, line, tab=True):
     new = Quadruple()
     elem1 = Element()
     elem1.constructor1(op1, Element.E_SCALAR)
     elem2 = Element()
     elem2.constructor1(gt, Element.E_GOTO)
     new.constructor_1(elem1, None, elem2, None, Quadruple.T_IF, line, tab)
     self.fuente.append(new)
Exemple #5
0
 def addAritOp(self, dest, op1, op2, op, line):
     new = Quadruple()
     elem1 = Element()
     elem1.constructor1(op1, Element.E_SCALAR)
     elem2 = Element()
     elem2.constructor1(op2, Element.E_GOTO)
     elem3 = Element()
     elem3.constructor1(dest, Element.E_SCALAR)
     new.constructor_1(elem1, elem2, elem3, op, Quadruple.T_ARITOP, line)
     self.fuente.append(new)
Exemple #6
0
 def addGoto_IF(self, cadena, line, index, tab=True):
     new = Quadruple()
     elem1 = Element()
     elem1.constructor1(cadena, Element.E_GOTO)
     new.constructor_1(None, None, elem1, -1, Quadruple.T_GOTO, line, tab)
     self.fuente[index] = new
Exemple #7
0
 def addIgnoreString(self, cadena, line, tab):
     new = Quadruple()
     elem1 = Element()
     elem1.constructor1(cadena, -1)
     new.constructor_1(elem1, None, None, -1, Quadruple.T_IGNORE, line, tab)
     self.fuente.append(new)