These pages are auto-generated from self-documenting comments embedded in class files.
For more information on breve and steve, refer to the breve homepage.

## Object : PushInterpreter

This class is included as part of the file Push.tz.
To use this class in a simulation, include the line "@use Push."

### Class description:

> Summary: an interface to the Push programming language.

> The PushInterpreter object is used to setup and run programs in the Push programming language, a language developed specifically for evolutionary computation.

> Push is useful in breve for evolving evolved agent behaviors. The steve language, in which users write simulations, is a high level language which is not well suited for evolutionary computation. The Push language, on the other hand, is designed from the ground up for evolutionary computation.

> More information about Push is available on the Push project page.

### Class methods:

> Configuring and setting up a Push interpreter

> - add-instruction
> - add-macro
> - get-evaluation-limit
> - get-list-limit
> - read-config
> - set-evaluation-limit
> - set-list-limit

> Running a Push program

> - get-effort
> - reset-effort
> - run
> - run-with-exec-stack-dump
> - step

> Getting Push interpreter configuration and state information

> - print-config
> - print-exec-stack
> - print-stacks

> Pushing Values onto Push Stacks

> - push-boolean
> - push-code
> - push-exec
> - push-float
> - push-integer
> - push-vector

> Getting the Sizes of Push Stacks

> - get-boolean-stack-size
> - get-code-stack-size
> - get-exec-stack-size
> - get-float-stack-size
> - get-integer-stack-size
> - get-vector-stack-size

> Getting Values From the Top of Push Stacks

> - copy-code-stack-top
> - copy-exec-stack-top
> - get-boolean-stack-top
> - get-float-stack-top
> - get-integer-stack-top
> - get-vector-stack-top

> Popping the Push Stacks

> - clear-stacks
> - pop-boolean-stack
> - pop-code-stack
> - pop-exec-stack
> - pop-float-stack
> - pop-integer-stack
> - pop-vector-stack

`add-instruction for-instance targetInstance (object) for-method methodName (string) named instructionName = "" (string)`

> Adds a custom callback instruction named instructionName to the push interpreter. When instructionName is called, it will trigger the method methodName in targetInstance. If the instruction name is not specified, methodName will be used.

`add-macro named instructionName (string) for-code macroCode (object)`

> Adds a new instruction named instructionName. When the instructionName instruction is executed, it has the effect of executing the code contained in macroCode.

`clear-stacks`

> Clears the stacks of the Push interpreter.

`copy-code-stack-top to program (object)`

> Copies the top of the code stack to an existing program. Use get-code-stack-size to determine whether the code stack is empty or not.

`copy-exec-stack-top to program (object)`

> Copies the top of the code stack to an existing program. Use get-exec-stack-size to determine whether the code stack is empty or not.

`get-boolean-stack-size`

> Returns the size of the boolean stack.

`get-boolean-stack-top`

> Returns the top of the boolean stack. If the boolean stack is empty, the method returns 0 (false). Use get-boolean-stack-size to determine whether the boolean stack is empty or not.

`get-code-stack-size`

> Returns the size of the code stack.

`get-effort`

> Returns the "effort" of the Push interpreter--the running tally of instructions the interpreter has executed. for associating energy costs with computation in evolving populations.

`get-evaluation-limit`

> Returns the current push evaluation limit. See set-evaluation-limit for more information on the evaluation limit.

`get-exec-stack-size`

> Returns the size of the code stack.

`get-float-stack-size`

> Returns the size of the float stack.

`get-float-stack-top`

> Returns the top of the float stack. If the float stack is empty, the method returns 0.0. Use get-float-stack-size to determine whether the boolean stack is empty or not.

`get-integer-stack-size`

> Returns the size of the integer stack.

`get-integer-stack-top`

> Returns the top of the interger stack. If the integer stack is empty, the method returns 0. Use get-integer-stack-size to determine whether the integer stack is empty or not.

`get-list-limit`

> Returns the size limit of lists constructed in push. See set-list-limit for more information.

`get-vector-stack-size`

> Returns the size of the vector stack.

`get-vector-stack-top`

> Returns the top of the vector stack. If the vector stack is empty, the method returns (0, 0, 0). Use get-vector-stack-size to determine whether the vector stack is empty or not.

`pop-boolean-stack`

> Pops the boolean stack. If the boolean stack is empty, this method has no effect.

`pop-code-stack`

> Pops the code stack. If the code stack is empty, this method has no effect.

`pop-exec-stack`

> Pops the exec stack. If the code stack is empty, this method has no effect.

`pop-float-stack`

> Pops the float stack. If the float stack is empty, this method has no effect.

`pop-integer-stack`

> Pops the integer stack. If the integer stack is empty, this method has no effect.

`pop-vector-stack`

> Pops the vector stack. If the vector stack is empty, this method has no effect.

`print-config`

> Prints out the current push configuration, including a list of the active instructions. Useful for debugging.

`print-exec-stack`

> Prints out the current contents of the exec stack. Useful for debugging.

`print-stacks`

> Prints out the current contents of the stacks. Useful for debugging.

`push-boolean value booleanValue (int)`

> Pushes the boolean booleanValue (an integer in breve, where 0 is false and all other values are true) onto the boolean stack.

`push-code value codeObject (object)`

> Pushes the code codeObject onto the code stack.

`push-exec value codeObject (object)`

> Pushes the code codeObject onto the exec stack.

`push-float value floatValue (float)`

> Pushes the float floatValue onto the float stack.

`push-integer value integerValue (int)`

> Pushes the integer integerValue onto the integer stack.

`push-vector value vectorValue (vector)`

> Pushes the vector vectorValue onto the vector stack.

`read-config from-file configFile (string)`

> Reads the push configuration file configFile.

`reset-effort`

> Clears the effort counter to 0.

`run program codeObject (object) for-steps steps = -1 (int)`

> Runs the specified push code from the beginning of the program. If the steps variable is provided, evaluation will only run for the specified number of instructions. Otherwise, evaluation will run for the evaluation limit, which is set with set-evaluation-limit.

> The method returns 0 if the interpreter completely executes the program, or 1 if execution stopped due to the evaluation limit.

> If the program is not executed completely, execution may be stepped forward using the method step. In some cases, it may be desirable to step push programs forward in small increments by calling this method with steps = 0 in order to load the program, then using step to step the simulatation forward.

`run-with-exec-stack-dump program codeObject (object) for-steps steps = -1 (int)`

> Dumps out the exec stack at every instruction step. Extremely verbose. For debugging only.

`set-evaluation-limit to newLimit (int)`

> Sets the evaluation limit to newLimit. This specifies the number of instructions to run when the run is called. The default value for a new interpreter is 200.

`set-list-limit to newLimit (int)`

> Sets the size limit of lists constructed in push. This limit also applies to programs created using genetic operators. The default limit is 200.

`step for-steps steps = 1 (int)`

> Steps the interpreter forward by the specified number of instructions.

Documentation created Fri Aug 8 15:16:49 2008