def p_update_offset(p): """Update_Offset : """ var = sem.get_variable(p[-2]) type = var[1][0] expr.add_operator("#") for x in range(state.arr_current_dim - 1): expr.add_operator("+") expr.generate_quad(2) # Generates quads to sum all the indices if type[0] == "i" or type[0] == "f": sem.fill_symbol_table_constant(4, "int", 4) expr.add_operand(sem.get_variable(4)) expr.add_operator("*") expr.generate_quad(1) expr.pop_operator()
def p_seen_bool(p): """Seen_Bool : """ sem.fill_symbol_table_constant(p[-1], "bool", 1)
def p_seen_char(p): """Seen_Char : """ sem.fill_symbol_table_constant(p[-1], "char", 1)
def p_seen_int(p): """Seen_Int : """ sem.fill_symbol_table_constant(p[-1], "int", 4)
def p_seen_float(p): """Seen_Float : """ sem.fill_symbol_table_constant(p[-1], "float", 4)