spector-tutorial-gecco2016.key.pdf (1.5 MB)
I am trying to understand the Push program that is translated from a Plush program in these slides:
(exec_do*times (8 11) exec_if () (17 (false code_quote (float_mult)) exec_rot (34.44) () ()))
exec_do*times will be popped first, right? And since there is nothing on the integer stack at this point, it will be a no-op?
If there was say a
3 on the integer stack, would it then pop the first item off the exec stack (
(8 11) ) and push that back onto the exec stack 3 times? I can’t make heads or tails out of the implementation code.
I am trying to explain why having longer parenthesized code blocks is helpful, for the GPTP presentation. I am writing an example with
exec_do*times, but if you have a better instruction lemme know.
Is a Push program equal to the
exec stack at the beginning of execution?
Where do you see that code fragment?
The program to be executed is pushed onto the
:exec stack prior to execution. It is not equal to the stack; the stack is a sequence, the first (and only) item of which will be the program that you want to execute.
That said, assuming the program is a list, then after one step of execution all of its items will be pushed onto the stack, so that then the stack and the program will be the same… at least in terms of contents, but I’m not sure of the data types.
Woops, it is in our paper, not the presentation. I was flipping between them and got mixed up
Ok so the program is the first item on the exec stack? And here the program is a list, so each item in the list will be pushed onto the exec stack? So the exec stack will start as:
( (exec_do*times (8 11) exec_if () (17 (false code_quote (float_mult)) exec_rot (34.44) () ())) )
and after one step, this first item will be popped and all added back to the exec stack, so it looks like this:
( exec_do*times (8 11) exec_if () (17 (false code_quote (float_mult)) exec_rot (34.44) () ())) )
The program you are referring to is just there as an example translation from Plush to Push. I doubt it has any real use, and at first glance you are right – the
exec_do*times (and subsequent
exec_if will be treated as noops since there aren’t corresponding integer and boolean arguments. We included it to show off how the translation process worked, especially with regard to parentheses.
Thanks for the clarification. I just wanted to make sure I understand the execution correctly.