Skip to content

Commit

Permalink
run_with_compiler convenient function (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowone committed Apr 7, 2024
1 parent ceaae87 commit c53a597
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions aheui/aheui.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,11 @@ def prepare_compiler(contents, opt_level=2, source='code', aheuic_output=None, a
return compiler


def run_with_compiler(compiler):
program = Program(compiler.lines, compiler.label_map)
return mainloop(program, compiler.debug)


def entry_point(argv):
try:
cmd, source, contents, str_opt_level, target, aheuic_output, comment_aheuis, output, warning_limit, trace_limit = process_options(argv, os.environ)
Expand All @@ -499,8 +504,7 @@ def entry_point(argv):
if target == 'run':
if not PYR:
warnings.warn(NoRpythonWarning)
program = Program(compiler.lines, compiler.label_map)
exitcode = mainloop(program, compiler.debug)
exitcode = run_with_compiler(compiler)
elif target in ['asm', 'asm+comment']:
asm = compiler.write_asm(commented=comment_aheuis).encode('utf-8')
os.write(outfp, asm)
Expand Down

0 comments on commit c53a597

Please sign in to comment.