def get_vars(source): if is_string(source): source = parse(source) varhash = {} c1 = macroexpand(source) # fill varhash compile_expr(c1, varhash, [0]) return varhash
def compile_to_assembly(source, optimize_flag=1): if is_string(source): source = parse(source) c1 = macroexpand(source) c2 = decorate(c1) label_counter[0] = 0 varhash = {} c3 = compile_expr(c2, varhash) c4 = add_wrappers(c3, varhash) c5 = optimize(c4) if optimize_flag else c4 return c5
def assert_eq(expand, should_be=None, expand_1=None): if should_be is None: # Latter not specified, then it sohuld not change. should_be = expand ret = macros.macroexpand(expand) if ret != should_be: raise Exception('macroexpand wrong', ret, 'vs\n', should_be) if expand_1 is not None: ret = macros.macroexpand_1(expand) if ret != expand_1: raise Exception('Single step macroexpand wrong', ret, 'vs\n', expand_1)