Beispiel #1
0
    def compile_interactive(self, sexp):
        stmts = self.compile(sexp, "stmt").get_stmts()

        interactive = ast.Interactive(stmts)

        ast.fix_missing_locations(interactive)

        print("ast.dump:\n", astpp.dump(interactive))

        return compile(interactive, "<repl>", "single")
Beispiel #2
0
    def compile_module(self, sexps, name):
        res = PilsResult()
        for sexp in sexps:
            res += self.compile(sexp, "stmt")

        stmts = res.get_stmts()

        module = ast.Module(stmts)

        ast.fix_missing_locations(module)

        print("ast.dump:\n", astpp.dump(module))

        return compile(module, name, "exec")