MaMa support macros
This commit is contained in:
31
Uebung-01/test.py
Normal file
31
Uebung-01/test.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from MaMaGUI import MaMaGUI
|
||||
from MaMa import MaMa
|
||||
|
||||
if __name__ == "__main__":
|
||||
prog = {
|
||||
0: 'outer',
|
||||
1: 'stop'
|
||||
}
|
||||
|
||||
machine = MaMa(prog, [4, 6])
|
||||
|
||||
inner_prog = [
|
||||
'push(1)',
|
||||
'push(2)',
|
||||
'add',
|
||||
'stop'
|
||||
]
|
||||
|
||||
outer_prog = [
|
||||
'push(10)',
|
||||
'inner',
|
||||
'mult',
|
||||
'stop'
|
||||
]
|
||||
|
||||
machine.add_macro("inner", inner_prog, [])
|
||||
machine.add_macro("outer", outer_prog, [])
|
||||
|
||||
# Run machine once for GUI visualization
|
||||
gui = MaMaGUI(machine)
|
||||
gui.display()
|
||||
Reference in New Issue
Block a user