Example #1
0
def turn_if_to_while(elem, next_index_in_sequence):
	elem['mnemo'] = 'WHILE_LOOP'
	# we must also update the clauses describing this construct
	jump_clause, forward_clause = (END_OF_CONSTRUCT, WHILE_CLAUSE)
	pop_cond = elem['pop_cond']
	forward_index = next_index_in_sequence
	jump_index = elem['jump_index']
	update_next_indexes_of_conditional(elem, 
			jump_clause, jump_index, forward_clause, forward_index)
	update_pop_clauses_of_conditional(elem, pop_cond, jump_clause, forward_clause)
Example #2
0
def turn_if_to_while(elem, next_index_in_sequence):
    elem['mnemo'] = 'WHILE_LOOP'
    # we must also update the clauses describing this construct
    jump_clause, forward_clause = (END_OF_CONSTRUCT, WHILE_CLAUSE)
    pop_cond = elem['pop_cond']
    forward_index = next_index_in_sequence
    jump_index = elem['jump_index']
    update_next_indexes_of_conditional(elem, jump_clause, jump_index,
                                       forward_clause, forward_index)
    update_pop_clauses_of_conditional(elem, pop_cond, jump_clause,
                                      forward_clause)
Example #3
0
def prepare_if_element(elem, mnemo, next_index_in_sequence):
	desc = CONDITIONAL_JUMPS_DESC[mnemo]
	jump_cond = desc['jump_cond']
	elem['jump_cond'] = jump_cond	# useful for while loops
	jump_clause, forward_clause = get_if_jump_and_forward_clauses(jump_cond)
	jump_index = get_jump_index_of_conditional(elem, desc)
	elem['jump_index'] = jump_index # useful for while loops
	forward_index = next_index_in_sequence
	pop_cond = desc['pop_cond']
	elem['pop_cond'] = pop_cond		# useful for while loops
	update_next_indexes_of_conditional(elem, 
			jump_clause, jump_index, forward_clause, forward_index)
	update_pop_clauses_of_conditional(elem, pop_cond, jump_clause, forward_clause)
	elem['mnemo'] = 'IF_CONSTRUCT'
	elem['apply_conditions'] = []
	elem['dup_cond'] = False
Example #4
0
def prepare_if_element(elem, mnemo, next_index_in_sequence):
    desc = CONDITIONAL_JUMPS_DESC[mnemo]
    jump_cond = desc['jump_cond']
    elem['jump_cond'] = jump_cond  # useful for while loops
    jump_clause, forward_clause = get_if_jump_and_forward_clauses(jump_cond)
    jump_index = get_jump_index_of_conditional(elem, desc)
    elem['jump_index'] = jump_index  # useful for while loops
    forward_index = next_index_in_sequence
    pop_cond = desc['pop_cond']
    elem['pop_cond'] = pop_cond  # useful for while loops
    update_next_indexes_of_conditional(elem, jump_clause, jump_index,
                                       forward_clause, forward_index)
    update_pop_clauses_of_conditional(elem, pop_cond, jump_clause,
                                      forward_clause)
    elem['mnemo'] = 'IF_CONSTRUCT'
    elem['apply_conditions'] = []
    elem['dup_cond'] = False