def main(): env = {'PilsAtom': PilsAtom, 'PilsList': PilsList} import_core(env) if len(sys.argv) == 2: with open(sys.argv[1], 'r') as f: prog = f.read() compiler = PilsCompiler() sexps = PilsParser.parse_module(prog) exec(compiler.compile_module(sexps, sys.argv[1]), env) repl(env)
def import_core(env): core = pkg_resources.resource_string(__name__, 'core.pils').decode() compiler = PilsCompiler() sexps = PilsParser.parse_module(core) exec(compiler.compile_module(sexps, '<core>'), env)