[pypy-svn] r44096 - pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter

cfbolz at codespeak.net cfbolz at codespeak.net
Thu Jun 7 16:25:18 CEST 2007


Author: cfbolz
Date: Thu Jun  7 16:25:12 2007
New Revision: 44096

Modified:
   pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/compiler.py
   pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/interpreter.py
   pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/prologopcode.py
Log:
make pyrolog translatable again


Modified: pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/compiler.py
==============================================================================
--- pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/compiler.py	(original)
+++ pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/compiler.py	Thu Jun  7 16:25:12 2007
@@ -82,12 +82,13 @@
             self.emit_opcode(opcodedesc.DYNAMIC_CALL)
             return
         body = helper.ensure_callable(body)
-        if isinstance(body, Term):
-            if body.signature == ",/2":
-                self.compile_body(body.args[0])
-                self.compile_body(body.args[1])
-                return
-        if body.signature == "=/2":
+        if body.signature == ",/2":
+            assert isinstance(body, Term)
+            self.compile_body(body.args[0])
+            self.compile_body(body.args[1])
+            return
+        elif body.signature == "=/2":
+            assert isinstance(body, Term)
             self.compile_termbuilding(body.args[0])
             self.compile_termbuilding(body.args[1])
             self.emit_opcode(opcodedesc.UNIFY)

Modified: pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/interpreter.py
==============================================================================
--- pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/interpreter.py	(original)
+++ pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/interpreter.py	Thu Jun  7 16:25:12 2007
@@ -178,6 +178,7 @@
         stack.pop().unify(stack.pop(), self.engine.heap)
 
     def user_call(self, function, query, continuation):
+        assert isinstance(query, Callable)
         rulechain = function.rulechain
         if rulechain is None:
             error.throw_existence_error(

Modified: pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/prologopcode.py
==============================================================================
--- pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/prologopcode.py	(original)
+++ pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/prologopcode.py	Thu Jun  7 16:25:12 2007
@@ -34,7 +34,6 @@
 argument_op("CALL_BUILTIN", 'b', True)
 argument_op("CLEAR_LOCAL", 'x')
 def_op("UNIFY", 'U')
-def_op("CONTINUE", 'O')
 def_op("DYNAMIC_CALL", 'D', True)
 argument_op("STATIC_CALL", 's', True)
 def_op("CUT", 'C', True)



More information about the Pypy-commit mailing list