def p_exp_idassign1(self, p): """exp : ID ASSIGN exp""" p[0] = NonTerminal() p[0].value = p[1] p[0].code = p[3].code + p[1] + " " + p[2] + " " + str( p[3].get_value()) + ";\n" pass
def p_exp_false(self, p): """exp : FALSE""" p[0] = NonTerminal() p[0].place = self.new_temp() p[0].value = 0 # p[0].false_list = self.make_list(self.nextState) # p[0].code = "goto " + p[0].label + "anam;\n" pass
def p_const_true(self, p): """exp : TRUE""" p[0] = NonTerminal() p[0].place = self.new_temp() p[0].value = 1 # p[0].true_list = self.make_list(self.nextState) # p[0].code = "goto " + p[0].label + "manam;\n" pass
def p_exp_idassign2(self, p): """exp : ID LSB exp RSB ASSIGN exp""" p[0] = NonTerminal() # p[0].isArray = True p[0].value = "array[" + p[1] + " + " + str(p[3].get_value()) + "]" p[0].code = p[6].code + "array[" + p[1] + " + " + str( p[3].get_value()) + "] " + p[5] + " " + str( p[6].get_value()) + ";\n" pass
def p_const_floatnumber(self, p): """exp : FLOATNUMBER""" p[0] = NonTerminal() p[0].value = int(p[1]) pass
def p_const_integernumber(self, p): """exp : INTEGERNUMBER""" p[0] = NonTerminal() p[0].value = p[1] pass
def p_exp_idlsbrsb(self, p): """exp : ID LSB exp RSB""" p[0] = NonTerminal() p[0].value = "array[" + p[1] + " + " + str(p[3].get_value()) + "]" p[0].code = p[3].code pass
def p_exp_id(self, p): """exp : ID""" p[0] = NonTerminal() p[0].value = p[1] pass
def p_type_float(self, p): """type : FLOAT""" p[0] = NonTerminal() p[0].value = p[1] pass
def p_type_int(self, p): """type : INTEGER""" p[0] = NonTerminal() p[0].value = p[1] pass