[Push] Top Level Code or Exec?

Lee Spector lspector at hampshire.edu
Mon Apr 19 21:28:42 EDT 2010


Same deal in the other implementations that I know about, although not implemented with CODE.DO* (although that is indeed elegant). 

It has to go on to the EXEC stack to be executed, and putting it on the CODE stack is handy for programs that manipulate their own code. In several implementations the push onto the CODE stack (and the post-run popping of the CODE stack, which in Maarten's implementation will also be accomplished by CODE.DO*) can be turned on or off with a parameter.

 -Lee

On Apr 19, 2010, at 4:01 PM, Maarten Keijzer wrote:

> 
> We wanted to have the program code on the code stack for the program to 
> manipulate. Although code on the exec stack could in principle copy itself on 
> the code stack (with some trouble), we thought it would be easiest to push the 
> code to be executed both on the code stack AND on the exec stack.
> 
> So that's what we do. In the C++ version, this is called the push calling 
> convention, and it is implemented by pushing code on the CODE stack, and 
> pushing the CODE.DO* instruction on the exec stack.
> 
> hth,
> 
> -Maarten-
> 
> 
> On Monday 19 April 2010 09:46:21 pm Rud Merriam wrote:
>> The documentation on Push3 is a bit confusing as to where to load a program.
>> 
>> In discussing configuration and later in the Factorial example the
>> implication is that a program is read from a file and then pushed onto the
>> CODE stack.
>> 
>> But the description of the execution environment - where the CODE and EXEC
>> execution is contrasted - seems to imply a program is pushed onto the EXEC
>> stack. This is in the Push Concepts section.
>> 
>> I'm guessing the pushing to CODE is the approach used, although it seems
>> inconsistent with the switch to EXEC in Push3. 
>> 
>> 
>> - 73 - 
>> Rud Merriam K5RUD 
>> http://mysticlakesoftware.com/
>> 
>> 
> _______________________________________________
> Push mailing list
> Push at lists.hampshire.edu
> https://lists.hampshire.edu/mailman/listinfo/push

--
Lee Spector, Professor of Computer Science
School of Cognitive Science, Hampshire College
893 West Street, Amherst, MA 01002-3359
lspector at hampshire.edu, http://hampshire.edu/lspector/
Phone: 413-559-5352, Fax: 413-559-5438

Check out Genetic Programming and Evolvable Machines:
http://www.springer.com/10710 - http://gpemjournal.blogspot.com/



More information about the Push mailing list