gkbrk / python-jvm-interpreter Goto Github PK
View Code? Open in Web Editor NEWJava Virtual Machine implementation in Python
License: GNU Affero General Public License v3.0
Java Virtual Machine implementation in Python
License: GNU Affero General Public License v3.0
Should this be frame.ip instead of ip?
flake8 testing of https://github.com/gkbrk/python-jvm-interpreter on Python 3.7.0
$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
./pyjvm/Machine.py:483:79: F821 undefined name 'ip'
cl.handleMethod('<clinit>', '()V', frame, code, self, ip)
^
1 F821 undefined name 'ip'
1
Would it be difficult to extend this to transpile JVM bytecode to Python?
I merely git clonned and ran the tests..
$ sh test.sh
EEEE............EE
======================================================================
ERROR: test_cocktail_sort (__main__.ArrayTest.test_cocktail_sort)
----------------------------------------------------------------------
Traceback (most recent call last):
File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/run_unittest.py", line 89, in setUp
self.jvm.load_class_file('example/ArrayTest.class')
File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/Machine.py", line 378, in load_class_file
c = ClassFile().from_file(path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/ClassFile.py", line 80, in from_file
c = CPInfo().from_reader(cf)
^^^^^^^^^^^^^^^^^^^^^^^^
File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/CPInfo.py", line 20, in from_reader
self.tag = CPTag(tag)
^^^^^^^^^^
File "E:/msys64/ucrt64/lib/python3.11/enum.py", line 712, in __call__
return cls.__new__(cls, value)
^^^^^^^^^^^^^^^^^^^^^^^
File "E:/msys64/ucrt64/lib/python3.11/enum.py", line 1135, in __new__
raise ve_exc
ValueError: 18 is not a valid CPTag
======================================================================
ERROR: test_insertion_sort (__main__.ArrayTest.test_insertion_sort)
----------------------------------------------------------------------
Traceback (most recent call last):
File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/run_unittest.py", line 89, in setUp
self.jvm.load_class_file('example/ArrayTest.class')
File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/Machine.py", line 378, in load_class_file
c = ClassFile().from_file(path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/ClassFile.py", line 80, in from_file
c = CPInfo().from_reader(cf)
^^^^^^^^^^^^^^^^^^^^^^^^
File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/CPInfo.py", line 20, in from_reader
self.tag = CPTag(tag)
^^^^^^^^^^
File "E:/msys64/ucrt64/lib/python3.11/enum.py", line 712, in __call__
return cls.__new__(cls, value)
^^^^^^^^^^^^^^^^^^^^^^^
File "E:/msys64/ucrt64/lib/python3.11/enum.py", line 1135, in __new__
raise ve_exc
ValueError: 18 is not a valid CPTag
======================================================================
ERROR: test_loop_multiple (__main__.ArrayTest.test_loop_multiple)
----------------------------------------------------------------------
Traceback (most recent call last):
File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/run_unittest.py", line 89, in setUp
self.jvm.load_class_file('example/ArrayTest.class')
File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/Machine.py", line 378, in load_class_file
c = ClassFile().from_file(path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/ClassFile.py", line 80, in from_file
c = CPInfo().from_reader(cf)
^^^^^^^^^^^^^^^^^^^^^^^^
File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/CPInfo.py", line 20, in from_reader
self.tag = CPTag(tag)
^^^^^^^^^^
File "E:/msys64/ucrt64/lib/python3.11/enum.py", line 712, in __call__
return cls.__new__(cls, value)
^^^^^^^^^^^^^^^^^^^^^^^
File "E:/msys64/ucrt64/lib/python3.11/enum.py", line 1135, in __new__
raise ve_exc
ValueError: 18 is not a valid CPTag
======================================================================
ERROR: test_sum (__main__.ArrayTest.test_sum)
----------------------------------------------------------------------
Traceback (most recent call last):
File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/run_unittest.py", line 89, in setUp
self.jvm.load_class_file('example/ArrayTest.class')
File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/Machine.py", line 378, in load_class_file
c = ClassFile().from_file(path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/ClassFile.py", line 80, in from_file
c = CPInfo().from_reader(cf)
^^^^^^^^^^^^^^^^^^^^^^^^
File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/CPInfo.py", line 20, in from_reader
self.tag = CPTag(tag)
^^^^^^^^^^
File "E:/msys64/ucrt64/lib/python3.11/enum.py", line 712, in __call__
return cls.__new__(cls, value)
^^^^^^^^^^^^^^^^^^^^^^^
File "E:/msys64/ucrt64/lib/python3.11/enum.py", line 1135, in __new__
raise ve_exc
ValueError: 18 is not a valid CPTag
======================================================================
ERROR: test_reverse_string (__main__.StringTest.test_reverse_string)
----------------------------------------------------------------------
Traceback (most recent call last):
File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/run_unittest.py", line 56, in setUp
self.jvm.load_class_file('example/StringTest.class')
File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/Machine.py", line 378, in load_class_file
c = ClassFile().from_file(path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/ClassFile.py", line 80, in from_file
c = CPInfo().from_reader(cf)
^^^^^^^^^^^^^^^^^^^^^^^^
File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/CPInfo.py", line 20, in from_reader
self.tag = CPTag(tag)
^^^^^^^^^^
File "E:/msys64/ucrt64/lib/python3.11/enum.py", line 712, in __call__
return cls.__new__(cls, value)
^^^^^^^^^^^^^^^^^^^^^^^
File "E:/msys64/ucrt64/lib/python3.11/enum.py", line 1135, in __new__
raise ve_exc
ValueError: 18 is not a valid CPTag
======================================================================
ERROR: test_rot13_hello_world (__main__.StringTest.test_rot13_hello_world)
----------------------------------------------------------------------
Traceback (most recent call last):
File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/run_unittest.py", line 56, in setUp
self.jvm.load_class_file('example/StringTest.class')
File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/Machine.py", line 378, in load_class_file
c = ClassFile().from_file(path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/ClassFile.py", line 80, in from_file
c = CPInfo().from_reader(cf)
^^^^^^^^^^^^^^^^^^^^^^^^
File "E:/msys64/home/topkek/t/a/python-jvm-interpreter/pyjvm/CPInfo.py", line 20, in from_reader
self.tag = CPTag(tag)
^^^^^^^^^^
File "E:/msys64/ucrt64/lib/python3.11/enum.py", line 712, in __call__
return cls.__new__(cls, value)
^^^^^^^^^^^^^^^^^^^^^^^
File "E:/msys64/ucrt64/lib/python3.11/enum.py", line 1135, in __new__
raise ve_exc
ValueError: 18 is not a valid CPTag
----------------------------------------------------------------------
Ran 18 tests in 0.236s
FAILED (errors=6)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.