Implement MaMa machine
This commit is contained in:
34
Uebung-01/ggt.py
Normal file
34
Uebung-01/ggt.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from MaMaGUI import MaMaGUI
|
||||
from MaMa import MaMa
|
||||
|
||||
if __name__ == "__main__":
|
||||
prog = {
|
||||
0: 'ldo(-1)',
|
||||
1: 'push(0)',
|
||||
2: 'equal(17)',
|
||||
3: 'push(0)',
|
||||
4: 'ldo(-1)',
|
||||
5: 'equal(19)',
|
||||
6: 'ldo(-1)',
|
||||
7: 'ldo(-1)',
|
||||
8: 'leq(14)',
|
||||
9: 'ldo(-1)',
|
||||
10: 'ldo(-1)',
|
||||
11: 'sub',
|
||||
12: 'sto(-2)',
|
||||
13: 'ujp(6)',
|
||||
14: 'ldo(-1)',
|
||||
15: 'sub',
|
||||
16: 'ujp(3)',
|
||||
17: 'sto(-1)',
|
||||
18: 'stop',
|
||||
19: 'pop',
|
||||
20: 'stop'
|
||||
}
|
||||
|
||||
# Create and execute MaMa instance
|
||||
machine = MaMa(prog, [4, 6])
|
||||
|
||||
# Visualize finished execution using journal
|
||||
gui = MaMaGUI(machine)
|
||||
gui.display()
|
||||
Reference in New Issue
Block a user