Last active
October 19, 2022 20:01
-
-
Save acdimalev/535a821d5c3ecafb9a610c33b4b1d717 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-6.html | |
from bs4 import BeautifulSoup | |
soup = BeautifulSoup(open('jvms-6.html', encoding='ISO8859').read(), 'html.parser') | |
ops = { | |
div['title']: { | |
'words': len(div.find('div', {'class': 'literallayout'}).find_all('br')) - 1, | |
'opcodes': [ | |
int(p.text.split(' ')[2]) | |
for p in div.find('div', {'title': 'Forms'}).find_all('p') | |
], | |
} | |
for div in soup.find_all('div', {'class': 'section-execution'})[1:] | |
} | |
words = [None] * 256 | |
for op in ops.values(): | |
for opcode in op['opcodes']: | |
words[opcode] = op['words'] | |
print(' '.join([' '] + [f'{x:x}' for x in range(16)])) | |
for h in range(16): | |
print(f'{h:x}', end='') | |
for l in range(16): | |
x = str(words[h << 4 | l] or ' ') | |
print(f'{x:>3}', end='') | |
print() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0 1 2 3 4 5 6 7 8 9 a b c d e f | |
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | |
1 2 3 2 3 3 2 2 2 2 2 1 1 1 1 1 1 | |
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | |
3 1 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 | |
4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | |
5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | |
6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | |
7 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | |
8 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 | |
9 1 1 1 1 1 1 1 1 1 3 3 3 3 3 3 3 | |
a 3 3 3 3 3 3 3 3 3 2 15 11 1 1 1 1 | |
b 1 1 3 3 3 3 3 3 3 5 5 3 2 3 1 1 | |
c 3 3 1 1 4 4 3 3 5 5 | |
d | |
e | |
f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment