-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
331 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Function: main/0 | ||
Constants: None, 5, 6 | ||
Locals: x, y, z | ||
Globals: print | ||
BEGIN | ||
LOAD_CONST 1 | ||
STORE_FAST 0 | ||
LOAD_CONST 2 | ||
STORE_FAST 1 | ||
LOAD_FAST 0 | ||
LOAD_FAST 1 | ||
BINARY_ADD | ||
STORE_FAST 2 | ||
LOAD_GLOBAL 0 | ||
LOAD_FAST 2 | ||
CALL_FUNCTION 1 | ||
POP_TOP | ||
LOAD_CONST 0 | ||
RETURN_VALUE | ||
END |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from disassembler import * | ||
|
||
def main(): | ||
x = 5 | ||
y = 6 | ||
z = x + y | ||
print(z) | ||
|
||
disassemble(main) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
Function: main/0 | ||
Constants: None, "Enter a number: ", "/", "=" | ||
Locals: x, y, z, ex | ||
Globals: float, input, print, Exception | ||
BEGIN | ||
SETUP_EXCEPT label00 | ||
LOAD_GLOBAL 0 | ||
LOAD_GLOBAL 1 | ||
LOAD_CONST 1 | ||
CALL_FUNCTION 1 | ||
CALL_FUNCTION 1 | ||
STORE_FAST 0 | ||
LOAD_GLOBAL 0 | ||
LOAD_GLOBAL 1 | ||
LOAD_CONST 1 | ||
CALL_FUNCTION 1 | ||
CALL_FUNCTION 1 | ||
STORE_FAST 1 | ||
LOAD_FAST 0 | ||
LOAD_FAST 1 | ||
BINARY_TRUE_DIVIDE | ||
STORE_FAST 2 | ||
LOAD_GLOBAL 2 | ||
LOAD_FAST 0 | ||
LOAD_CONST 2 | ||
LOAD_FAST 1 | ||
LOAD_CONST 3 | ||
LOAD_FAST 2 | ||
CALL_FUNCTION 5 | ||
POP_TOP | ||
POP_BLOCK | ||
JUMP_FORWARD label03 | ||
label00: DUP_TOP | ||
LOAD_GLOBAL 3 | ||
COMPARE_OP 10 | ||
POP_JUMP_IF_FALSE label02 | ||
POP_TOP | ||
STORE_FAST 3 | ||
POP_TOP | ||
SETUP_FINALLY label01 | ||
LOAD_GLOBAL 2 | ||
LOAD_FAST 3 | ||
CALL_FUNCTION 1 | ||
POP_TOP | ||
POP_BLOCK | ||
POP_EXCEPT | ||
LOAD_CONST 0 | ||
label01: LOAD_CONST 0 | ||
STORE_FAST 3 | ||
DELETE_FAST 3 | ||
END_FINALLY | ||
JUMP_FORWARD label03 | ||
label02: END_FINALLY | ||
label03: LOAD_CONST 0 | ||
RETURN_VALUE | ||
END |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import disassembler | ||
|
||
def main(): | ||
try: | ||
x = int(input("Enter a number: ")) | ||
y = float(input("Enter a number: ")) | ||
z = x / y | ||
|
||
print(x,"/",y,"=",z) | ||
except Exception as ex: | ||
print(ex) | ||
|
||
main() | ||
#disassembler.disassemble(main) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Function: main/0 | ||
Constants: None, 5, 6 | ||
Locals: x, y | ||
Globals: print | ||
BEGIN | ||
LOAD_CONST 1 | ||
STORE_FAST 0 | ||
LOAD_CONST 2 | ||
STORE_FAST 1 | ||
LOAD_FAST 0 | ||
LOAD_FAST 1 | ||
COMPARE_OP 4 | ||
POP_JUMP_IF_FALSE label00 | ||
LOAD_GLOBAL 0 | ||
LOAD_FAST 0 | ||
CALL_FUNCTION 1 | ||
POP_TOP | ||
JUMP_FORWARD label00 | ||
label00: LOAD_GLOBAL 0 | ||
LOAD_FAST 1 | ||
CALL_FUNCTION 1 | ||
POP_TOP | ||
LOAD_CONST 0 | ||
RETURN_VALUE | ||
END |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import disassembler | ||
|
||
def main(): | ||
x = 5 | ||
y = 6 | ||
if x > y: | ||
print(x) | ||
|
||
print(y) | ||
|
||
#main() | ||
|
||
disassembler.disassemble(main) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Function: main/0 | ||
Constants: None, 5, 6 | ||
Locals: x, y, z | ||
Globals: print | ||
BEGIN | ||
LOAD_CONST 1 | ||
STORE_FAST 0 | ||
LOAD_CONST 2 | ||
STORE_FAST 1 | ||
LOAD_FAST 0 | ||
LOAD_FAST 1 | ||
COMPARE_OP 4 | ||
POP_JUMP_IF_FALSE label00 | ||
LOAD_FAST 0 | ||
STORE_FAST 2 | ||
JUMP_FORWARD label01 | ||
label00: LOAD_FAST 1 | ||
STORE_FAST 2 | ||
label01: LOAD_GLOBAL 0 | ||
LOAD_FAST 2 | ||
CALL_FUNCTION 1 | ||
POP_TOP | ||
LOAD_CONST 0 | ||
RETURN_VALUE | ||
END |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import disassembler | ||
|
||
def main(): | ||
x = 5 | ||
y = 6 | ||
if x > y: | ||
z = x | ||
else: | ||
z = y | ||
|
||
print(z) | ||
|
||
#main() | ||
|
||
disassembler.disassemble(main) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import disassembler | ||
|
||
def main(): | ||
x = 5 | ||
y = 6 | ||
print(x if x > y else y) | ||
|
||
#main() | ||
|
||
disassembler.disassemble(main) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Function: main/0 | ||
Constants: None, "Please enter an integer: ", "Please enter a number: ", "The product is" | ||
Locals: x, y | ||
Globals: int, input, float, print | ||
BEGIN | ||
LOAD_GLOBAL 0 | ||
LOAD_GLOBAL 1 | ||
LOAD_CONST 1 | ||
CALL_FUNCTION 1 | ||
CALL_FUNCTION 1 | ||
STORE_FAST 0 | ||
LOAD_GLOBAL 2 | ||
LOAD_GLOBAL 1 | ||
LOAD_CONST 2 | ||
CALL_FUNCTION 1 | ||
CALL_FUNCTION 1 | ||
STORE_FAST 1 | ||
LOAD_GLOBAL 3 | ||
LOAD_CONST 3 | ||
LOAD_FAST 0 | ||
LOAD_FAST 1 | ||
BINARY_MULTIPLY | ||
CALL_FUNCTION 2 | ||
POP_TOP | ||
LOAD_CONST 0 | ||
RETURN_VALUE | ||
END |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import disassembler | ||
|
||
def main(): | ||
x = int(input("Please enter an integer: ")) | ||
y = float(input("Please enter a number: ")) | ||
print("The product is", x*y) | ||
|
||
#main() | ||
|
||
disassembler.disassemble(main) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import disassembler | ||
|
||
def main(): | ||
|
||
name = input("Enter your name: ") | ||
age = int(input("Enter your age: ")) | ||
print(name + ", a year from now you will be", age+1, "years old.") | ||
|
||
#main() | ||
|
||
disassembler.disassemble(main) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Function: main/0 | ||
Constants: None, "hello", "world" | ||
Locals: lst | ||
Globals: print | ||
BEGIN | ||
LOAD_CONST 1 | ||
LOAD_CONST 2 | ||
BUILD_LIST 2 | ||
STORE_FAST 0 | ||
LOAD_GLOBAL 0 | ||
LOAD_FAST 0 | ||
CALL_FUNCTION 1 | ||
POP_TOP | ||
LOAD_CONST 0 | ||
RETURN_VALUE | ||
END |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import disassembler | ||
|
||
def main(): | ||
lst = ["hello","world"] | ||
print(lst) | ||
|
||
#main() | ||
disassembler.disassemble(main) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Function: main/0 | ||
Constants: None, "Enter a list of integers:" | ||
Locals: s, lst | ||
Globals: input, split, print | ||
BEGIN | ||
LOAD_GLOBAL 0 | ||
LOAD_CONST 1 | ||
CALL_FUNCTION 1 | ||
STORE_FAST 0 | ||
LOAD_FAST 0 | ||
LOAD_ATTR 1 | ||
CALL_FUNCTION 0 | ||
STORE_FAST 1 | ||
LOAD_GLOBAL 2 | ||
LOAD_FAST 1 | ||
CALL_FUNCTION 1 | ||
POP_TOP | ||
LOAD_CONST 0 | ||
RETURN_VALUE | ||
END |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import disassembler | ||
|
||
def main(): | ||
s = input("Enter a list of integers:") | ||
lst = s.split() | ||
|
||
print(lst) | ||
|
||
#main() | ||
disassembler.disassemble(main) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Function: main/0 | ||
Constants: None, 7, 6 | ||
Locals: x, y | ||
Globals: print | ||
BEGIN | ||
SETUP_LOOP label01 | ||
LOAD_CONST 1 | ||
STORE_FAST 0 | ||
LOAD_CONST 2 | ||
STORE_FAST 1 | ||
LOAD_FAST 0 | ||
LOAD_FAST 1 | ||
COMPARE_OP 1 | ||
POP_JUMP_IF_TRUE label00 | ||
BREAK_LOOP | ||
LOAD_GLOBAL 0 | ||
LOAD_FAST 0 | ||
CALL_FUNCTION 1 | ||
POP_TOP | ||
label00: POP_BLOCK | ||
label01: LOAD_GLOBAL 0 | ||
LOAD_FAST 1 | ||
CALL_FUNCTION 1 | ||
RETURN_VALUE | ||
END |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import disassembler | ||
|
||
def main(): | ||
f = 8 | ||
i = 1 | ||
j = 1 | ||
n = 1 | ||
while n < f: | ||
n = n + 1 | ||
tmp = j | ||
j = j + i | ||
i = tmp | ||
|
||
print("Fibonacci("+str(n)+") is",i) | ||
|
||
#main() | ||
disassembler.disassemble(main) |