Changeset 14328 for branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/OpCode.cs
- Timestamp:
- 10/08/16 12:04:25 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/OpCode.cs
r14320 r14328 18 18 /// <summary> 19 19 /// BOOLEAN.DEFINE: 20 /// Defines the name on top of the NAME stack as an in struction that will push the top item of the BOOLEAN stack onto the EXEC stack.20 /// Defines the name on top of the NAME stack as an inclassion that will push the top item of the BOOLEAN stack onto the EXEC stack. 21 21 /// </summary> 22 22 BooleanDefine, … … 24 24 /// <summary> 25 25 /// BOOLEAN.DUP: 26 /// Duplicate s the top item on the BOOLEAN stack. Does not pop its argument (which, if it did, would negate the effect of the duplication!)27 /// </summary> 28 BooleanDup ,26 /// Duplicatelicates the top item on the BOOLEAN stack. Does not pop its argument (which, if it did, would negate the effect of the duplication!) 27 /// </summary> 28 BooleanDuplicate, 29 29 30 30 /// <summary> … … 109 109 /// Pushes a copy of an indexed item "deep" in the stack onto the top of the stack, without removing the deep item. The index is taken from the INTEGER stack. 110 110 /// </summary> 111 BooleanYankDup ,111 BooleanYankDuplicate, 112 112 #endregion Boolean 113 113 … … 123 123 /// <summary> 124 124 /// CODE.APPEND: 125 /// Pushes the result of appending the top two pieces of code. If one of the pieces of code is a single in struction or literal (that is, something not surrounded by parentheses) then it is surrounded by parentheses first.125 /// Pushes the result of appending the top two pieces of code. If one of the pieces of code is a single inclassion or literal (that is, something not surrounded by parentheses) then it is surrounded by parentheses first. 126 126 /// </summary> 127 127 CodeAppend, … … 129 129 /// <summary> 130 130 /// CODE.ATOM: 131 /// Pushes TRUE onto the BOOLEAN stack if the top piece of code is a single in struction or a literal, and FALSE otherwise (that is, if it is something surrounded by parentheses).131 /// Pushes TRUE onto the BOOLEAN stack if the top piece of code is a single inclassion or a literal, and FALSE otherwise (that is, if it is something surrounded by parentheses). 132 132 /// </summary> 133 133 CodeAtom, … … 165 165 /// <summary> 166 166 /// CODE.DEFINE: 167 /// Defines the name on top of the NAME stack as an in struction that will push the top item of the CODE stack onto the EXEC stack.167 /// Defines the name on top of the NAME stack as an inclassion that will push the top item of the CODE stack onto the EXEC stack. 168 168 /// </summary> 169 169 CodeDefine, … … 171 171 /// <summary> 172 172 /// CODE.DEFINITION: 173 /// Pushes the definition associated with the top NAME on the NAME stack (if any) onto the CODE stack. This extracts the definition for inspection/manipulation, rather than for immediate execution (although it may then be executed with a call to CODE.DO or a similar in struction).173 /// Pushes the definition associated with the top NAME on the NAME stack (if any) onto the CODE stack. This extracts the definition for inspection/manipulation, rather than for immediate execution (although it may then be executed with a call to CODE.DO or a similar inclassion). 174 174 /// </summary> 175 175 CodeDefinition, … … 178 178 /// CODE.DESCREPANCY: 179 179 /// Pushes a measure of the discrepancy between the top two CODE stack items onto the INTEGER stack. This will be zero if the top two items are equivalent, and will be higher the 'more different' the items are from one another. The calculation is as follows: 180 /// 1. Con structa list of all of the unique items in both of the lists (where uniqueness is determined by equalp). Sub-lists and atoms all count as items.180 /// 1. Conclass a list of all of the unique items in both of the lists (where uniqueness is determined by equalp). Sub-lists and atoms all count as items. 181 181 /// 2. Initialize the result to zero. 182 182 /// 3. For each unique item increment the result by the difference between the number of occurrences of the item in the two pieces of code. … … 199 199 /// <summary> 200 200 /// CODE.DO*COUNT: 201 /// An iteration in struction that performs a loop (the body of which is taken from the CODE stack) the number of times indicated by the INTEGER argument, pushing an index (which runs from zero to one less than the number of iterations) onto the INTEGER stack prior to each execution of the loop body. This should be implemented as a macro that expands into a call to CODE.DO*RANGE. CODE.DO*COUNT takes a single INTEGER argument (the number of times that the loop will be executed) and a single CODE argument (the body of the loop). If the provided INTEGER argument is negative or zero then this becomes a NOOP. Otherwise it expands into:201 /// An iteration inclassion that performs a loop (the body of which is taken from the CODE stack) the number of times indicated by the INTEGER argument, pushing an index (which runs from zero to one less than the number of iterations) onto the INTEGER stack prior to each execution of the loop body. This should be implemented as a macro that expands into a call to CODE.DO*RANGE. CODE.DO*COUNT takes a single INTEGER argument (the number of times that the loop will be executed) and a single CODE argument (the body of the loop). If the provided INTEGER argument is negative or zero then this becomes a NOOP. Otherwise it expands into: 202 202 /// ( 0 '1 - IntegerArg' CODE.QUOTE <CodeArg> CODE.DO*RANGE ) 203 203 /// </summary> … … 206 206 /// <summary> 207 207 /// CODE.DO*RANGE: 208 /// An iteration in struction that executes the top item on the CODE stack a number of times that depends on the top two integers, while also pushing the loop counter onto the INTEGER stack for possible access during the execution of the body of the loop. The top integer is the "destination index" and the second integer is the "current index." First the code and the integer arguments are saved locally and popped. Then the integers are compared. If the integers are equal then the current index is pushed onto the INTEGER stack and the code (which is the "body" of the loop) is pushed onto the EXEC stack for subsequent execution. If the integers are not equal then the current index will still be pushed onto the INTEGER stack but two items will be pushed onto the EXEC stack -- first a recursive call to CODE.DO*RANGE (with the same code and destination index, but with a current index that has been either incremented or decremented by 1 to be closer to the destination index) and then the body code. Note that the range is inclusive of both endpoints; a call with integer arguments 3 and 5 will cause its body to be executed 3 times, with the loop counter having the values 3, 4, and 5. Note also that one can specify a loop that "counts down" by providing a destination index that is less than the specified current index.208 /// An iteration inclassion that executes the top item on the CODE stack a number of times that depends on the top two integers, while also pushing the loop counter onto the INTEGER stack for possible access during the execution of the body of the loop. The top integer is the "destination index" and the second integer is the "current index." First the code and the integer arguments are saved locally and popped. Then the integers are compared. If the integers are equal then the current index is pushed onto the INTEGER stack and the code (which is the "body" of the loop) is pushed onto the EXEC stack for subsequent execution. If the integers are not equal then the current index will still be pushed onto the INTEGER stack but two items will be pushed onto the EXEC stack -- first a recursive call to CODE.DO*RANGE (with the same code and destination index, but with a current index that has been either incremented or decremented by 1 to be closer to the destination index) and then the body code. Note that the range is inclusive of both endpoints; a call with integer arguments 3 and 5 will cause its body to be executed 3 times, with the loop counter having the values 3, 4, and 5. Note also that one can specify a loop that "counts down" by providing a destination index that is less than the specified current index. 209 209 /// </summary> 210 210 CodeDoXRange, … … 218 218 /// <summary> 219 219 /// CODE.DUP: 220 /// Duplicate s the top item on the CODE stack. Does not pop its argument (which, if it did, would negate the effect of the duplication!).221 /// </summary> 222 CodeDup ,220 /// Duplicatelicates the top item on the CODE stack. Does not pop its argument (which, if it did, would negate the effect of the duplication!). 221 /// </summary> 222 CodeDuplicate, 223 223 224 224 /// <summary> 225 225 /// CODE.EXTRACT: 226 /// Pushes the sub-expression of the top item of the CODE stack that is indexed by the top item of the INTEGER stack. The indexing here counts "points," where each parenthesized expression and each literal/in struction is considered a point, and it proceeds in depth first order. The entire piece of code is at index 0; if it is a list then the first item in the list is at index 1, etc. The integer used as the index is taken modulo the number of points in the overall expression (and its absolute value is taken in case it is negative) to ensure that it is within the meaningful range.226 /// Pushes the sub-expression of the top item of the CODE stack that is indexed by the top item of the INTEGER stack. The indexing here counts "points," where each parenthesized expression and each literal/inclassion is considered a point, and it proceeds in depth first order. The entire piece of code is at index 0; if it is a list then the first item in the list is at index 1, etc. The integer used as the index is taken modulo the number of points in the overall expression (and its absolute value is taken in case it is negative) to ensure that it is within the meaningful range. 227 227 /// </summary> 228 228 CodeExtract, … … 265 265 266 266 /// <summary> 267 /// CODE.INSTRUCTIONS: 268 /// Pushes a list of all active instructions in the interpreter's current configuration. 269 /// </summary> 270 CodeInstructions, 271 272 /// <summary> 267 273 /// CODE.INSERT: 268 274 /// Pushes the result of inserting the second item of the CODE stack into the first item, at the position indexed by the top item of the INTEGER stack (and replacing whatever was there formerly). The indexing is computed as in CODE.EXTRACT. … … 272 278 /// <summary> 273 279 /// CODE.INSTRUCTIONS: 274 /// Pushes a list of all active in structions in the interpreter's current configuration.275 /// </summary> 276 CodeIn structions,280 /// Pushes a list of all active inclassions in the interpreter's current configuration. 281 /// </summary> 282 CodeInclassions, 277 283 278 284 /// <summary> … … 311 317 312 318 /// <summary> 319 /// CODE.NULL: Pushes TRUE onto the BOOLEAN stack if the top item of the CODE stack is an empty list, or FALSE otherwise. 320 /// </summary> 321 CodeNull, 322 323 /// <summary> 324 /// CODE.POSITION: 325 /// Pushes onto the INTEGER stack the position of the second item on the CODE stack within the first item (which is coerced to a list if necessary). Pushes -1 if no match is found. 326 /// </summary> 327 CodePosition, 328 329 /// <summary> 313 330 /// CODE.QUOTE: 314 331 /// Specifies that the next expression submitted for execution will instead be pushed literally onto the CODE stack. This can be implemented by moving the top item on the EXEC stack onto the CODE stack. … … 334 351 335 352 /// <summary> 336 /// CODE.SIZE: Pushes the number of "points" in the top piece of CODE onto the INTEGER stack. Each in struction, literal, and pair of parentheses counts as a point.353 /// CODE.SIZE: Pushes the number of "points" in the top piece of CODE onto the INTEGER stack. Each inclassion, literal, and pair of parentheses counts as a point. 337 354 /// </summary> 338 355 CodeSize, … … 364 381 /// Pushes a copy of an indexed item "deep" in the stack onto the top of the stack, without removing the deep item. The index is taken from the INTEGER stack. 365 382 /// </summary> 366 CodeYankDup ,383 CodeYankDuplicate, 367 384 #endregion Code 368 385 … … 380 397 /// <summary> 381 398 /// EXEC.DEFINE: 382 /// Defines the name on top of the NAME stack as an in struction that will push the top item of the EXEC stack back onto the EXEC stack.399 /// Defines the name on top of the NAME stack as an inclassion that will push the top item of the EXEC stack back onto the EXEC stack. 383 400 /// </summary> 384 401 ExecDefine, … … 386 403 /// <summary> 387 404 /// EXEC.DO*COUNT: 388 /// An iteration in struction that performs a loop (the body of which is taken from the EXEC stack) the number of times indicated by the INTEGER argument, pushing an index (which runs from zero to one less than the number of iterations) onto the INTEGER stack prior to each execution of the loop body. This is similar to CODE.DO*COUNT except that it takes its code argument from the EXEC stack. This should be implemented as a macro that expands into a call to EXEC.DO*RANGE. EXEC.DO*COUNT takes a single INTEGER argument (the number of times that the loop will be executed) and a single EXEC argument (the body of the loop). If the provided INTEGER argument is negative or zero then this becomes a NOOP. Otherwise it expands into:405 /// An iteration inclassion that performs a loop (the body of which is taken from the EXEC stack) the number of times indicated by the INTEGER argument, pushing an index (which runs from zero to one less than the number of iterations) onto the INTEGER stack prior to each execution of the loop body. This is similar to CODE.DO*COUNT except that it takes its code argument from the EXEC stack. This should be implemented as a macro that expands into a call to EXEC.DO*RANGE. EXEC.DO*COUNT takes a single INTEGER argument (the number of times that the loop will be executed) and a single EXEC argument (the body of the loop). If the provided INTEGER argument is negative or zero then this becomes a NOOP. Otherwise it expands into: 389 406 /// ( 0 <1 - IntegerArg> EXEC.DO*RANGE <ExecArg> ) 390 407 /// </summary> … … 393 410 /// <summary> 394 411 /// EXEC.DO*RANGE: 395 /// An iteration in struction that executes the top item on the EXEC stack a number of times that depends on the top two integers, while also pushing the loop counter onto the INTEGER stack for possible access during the execution of the body of the loop. This is similar to CODE.DO*COUNT except that it takes its code argument from the EXEC stack. The top integer is the "destination index" and the second integer is the "current index." First the code and the integer arguments are saved locally and popped. Then the integers are compared. If the integers are equal then the current index is pushed onto the INTEGER stack and the code (which is the "body" of the loop) is pushed onto the EXEC stack for subsequent execution. If the integers are not equal then the current index will still be pushed onto the INTEGER stack but two items will be pushed onto the EXEC stack -- first a recursive call to EXEC.DO*RANGE (with the same code and destination index, but with a current index that has been either incremented or decremented by 1 to be closer to the destination index) and then the body code. Note that the range is inclusive of both endpoints; a call with integer arguments 3 and 5 will cause its body to be executed 3 times, with the loop counter having the values 3, 4, and 5. Note also that one can specify a loop that "counts down" by providing a destination index that is less than the specified current index.412 /// An iteration inclassion that executes the top item on the EXEC stack a number of times that depends on the top two integers, while also pushing the loop counter onto the INTEGER stack for possible access during the execution of the body of the loop. This is similar to CODE.DO*COUNT except that it takes its code argument from the EXEC stack. The top integer is the "destination index" and the second integer is the "current index." First the code and the integer arguments are saved locally and popped. Then the integers are compared. If the integers are equal then the current index is pushed onto the INTEGER stack and the code (which is the "body" of the loop) is pushed onto the EXEC stack for subsequent execution. If the integers are not equal then the current index will still be pushed onto the INTEGER stack but two items will be pushed onto the EXEC stack -- first a recursive call to EXEC.DO*RANGE (with the same code and destination index, but with a current index that has been either incremented or decremented by 1 to be closer to the destination index) and then the body code. Note that the range is inclusive of both endpoints; a call with integer arguments 3 and 5 will cause its body to be executed 3 times, with the loop counter having the values 3, 4, and 5. Note also that one can specify a loop that "counts down" by providing a destination index that is less than the specified current index. 396 413 /// </summary> 397 414 ExecDoXRange, … … 405 422 /// <summary> 406 423 /// EXEC.DUP: 407 /// Duplicate s the top item on the EXEC stack. Does not pop its argument (which, if it did, would negate the effect of the duplication!). This may be thought of as a "DO TWICE" instruction.408 /// </summary> 409 ExecDup ,424 /// Duplicatelicates the top item on the EXEC stack. Does not pop its argument (which, if it did, would negate the effect of the duplication!). This may be thought of as a "DO TWICE" inclassion. 425 /// </summary> 426 ExecDuplicate, 410 427 411 428 /// <summary> 412 429 /// EXEC.FLUSH: 413 /// Empties the EXEC stack. This may be thought of as a "HALT" in struction.430 /// Empties the EXEC stack. This may be thought of as a "HALT" inclassion. 414 431 /// </summary> 415 432 ExecFlush, … … 428 445 429 446 /// <summary> 430 /// EXEC.POP: Pops the EXEC stack. This may be thought of as a "DONT" in struction.447 /// EXEC.POP: Pops the EXEC stack. This may be thought of as a "DONT" inclassion. 431 448 /// </summary> 432 449 ExecPop, … … 439 456 440 457 /// <summary> 458 /// EXEC.S: 459 /// The Push implementation of the "S combinator". Pops 3 items from the EXEC stack, which we will call A, B, and C (with A being the first one popped). Then pushes a list containing B and C back onto the EXEC stack, followed by another instance of C, followed by another instance of A. 460 /// </summary> 461 ExecS, 462 463 /// <summary> 441 464 /// EXEC.SHOVE: 442 /// Inserts the top EXEC item "deep" in the stack, at the position indexed by the top INTEGER. This may be thought of as a "DO LATER" in struction.465 /// Inserts the top EXEC item "deep" in the stack, at the position indexed by the top INTEGER. This may be thought of as a "DO LATER" inclassion. 443 466 /// </summary> 444 467 ExecShove, … … 464 487 /// <summary> 465 488 /// EXEC.YANK: 466 /// Removes an indexed item from "deep" in the stack and pushes it on top of the stack. The index is taken from the INTEGER stack. This may be thought of as a "DO SOONER" in struction.489 /// Removes an indexed item from "deep" in the stack and pushes it on top of the stack. The index is taken from the INTEGER stack. This may be thought of as a "DO SOONER" inclassion. 467 490 /// </summary> 468 491 ExecYank, … … 472 495 /// Pushes a copy of an indexed item "deep" in the stack onto the top of the stack, without removing the deep item. The index is taken from the INTEGER stack. 473 496 /// </summary> 474 ExecYankDup ,497 ExecYankDuplicate, 475 498 #endregion Exec 476 499 … … 533 556 /// <summary> 534 557 /// FLOAT.DEFINE: 535 /// Defines the name on top of the NAME stack as an in struction that will push the top item of the FLOAT stack onto the EXEC stack.558 /// Defines the name on top of the NAME stack as an inclassion that will push the top item of the FLOAT stack onto the EXEC stack. 536 559 /// </summary> 537 560 FloatDefine, … … 539 562 /// <summary> 540 563 /// FLOAT.DUP: 541 /// Duplicate s the top item on the FLOAT stack. Does not pop its argument (which, if it did, would negate the effect of the duplication!).542 /// </summary> 543 FloatDup ,564 /// Duplicatelicates the top item on the FLOAT stack. Does not pop its argument (which, if it did, would negate the effect of the duplication!). 565 /// </summary> 566 FloatDuplicate, 544 567 545 568 /// <summary> … … 636 659 /// Pushes a copy of an indexed item "deep" in the stack onto the top of the stack, without removing the deep item. The index is taken from the INTEGER stack. 637 660 /// </summary> 638 FloatYankDup ,661 FloatYankDuplicate, 639 662 640 663 #endregion Float … … 692 715 693 716 /// <summary> 694 /// INTEGER.COS:695 /// Pushes the cosine of the top item.696 /// </summary>697 IntegerCos,698 699 /// <summary>700 717 /// INTEGER.DEFINE: 701 /// Defines the name on top of the NAME stack as an in struction that will push the top item of the INTEGER stack onto the EXEC stack.718 /// Defines the name on top of the NAME stack as an inclassion that will push the top item of the INTEGER stack onto the EXEC stack. 702 719 /// </summary> 703 720 IntegerDefine, … … 705 722 /// <summary> 706 723 /// INTEGER.DUP: 707 /// Duplicate s the top item on the INTEGER stack. Does not pop its argument (which, if it did, would negate the effect of the duplication!).708 /// </summary> 709 IntegerDup ,724 /// Duplicatelicates the top item on the INTEGER stack. Does not pop its argument (which, if it did, would negate the effect of the duplication!). 725 /// </summary> 726 IntegerDuplicate, 710 727 711 728 /// <summary> … … 769 786 770 787 /// <summary> 771 /// INTEGER.SIN:772 /// Pushes the sine of the top item.773 /// </summary>774 IntegerSin,775 776 /// <summary>777 788 /// INTEGER.STACKDEPTH: 778 789 /// Pushes the stack depth onto the INTEGER stack. … … 787 798 788 799 /// <summary> 789 /// INTEGER.TAN:790 /// Pushes the tangent of the top item.791 /// </summary>792 IntegerTan,793 794 /// <summary>795 800 /// INTEGER.YANK: 796 801 /// Removes an indexed item from "deep" in the stack and pushes it on top of the stack. The index is taken from the INTEGER stack. … … 802 807 /// Pushes a copy of an indexed item "deep" in the stack onto the top of the stack, without removing the deep item. The index is taken from the INTEGER stack. 803 808 /// </summary> 804 IntegerYankDup ,809 IntegerYankDuplicate, 805 810 806 811 #endregion Integer … … 823 828 /// <summary> 824 829 /// NAME.DUP: 825 /// Duplicate s the top item on the NAME stack. Does not pop its argument (which, if it did, would negate the effect of the duplication!).826 /// </summary> 827 NameDup ,830 /// Duplicatelicates the top item on the NAME stack. Does not pop its argument (which, if it did, would negate the effect of the duplication!). 831 /// </summary> 832 NameDuplicate, 828 833 829 834 /// <summary> … … 890 895 /// Pushes a copy of an indexed item "deep" in the stack onto the top of the stack, without removing the deep item. The index is taken from the INTEGER stack. 891 896 /// </summary> 892 NameYankDup ,897 NameYankDuplicate, 893 898 #endregion Name 894 899 }
Note: See TracChangeset
for help on using the changeset viewer.