Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 3
0
 def __init__(self):
     self.Elem1 = Element()
     self.Elem2 = Element()
     self.resultado = Element()
     self.operador = -1
     self.type = 0
     self.line = -1
     self.typeOpt = 0
     self.comment = 0
Exemplo n.º 4
0
 def constructor_3(self, Quadruple):
     elem1 = Element()
     elem1.copy(Quadruple.Elem1)
     elem2 = Element()
     elem1.copy(Quadruple.Elem2)
     elem3 = Element()
     elem1.copy(Quadruple.resultado)
     self.constructor_1(elem1, elem2, elem3, Quadruple.operador,
                        Quadruple.type, Quadruple.line)
     self.typeOpt = Quadruple.typeOpt
Exemplo n.º 5
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)
Exemplo n.º 6
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)
Exemplo n.º 7
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
Exemplo n.º 8
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)
Exemplo n.º 9
0
 def addAritOp(self, dest, op1, op2, op, line, tab):
     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,
                       tab)
     self.fuente.append(new)