CRPL is a stack-based, Reverse Polish Notation language. There, now that we've said it, what does it mean?
If you have ever programmed a HP calcualtor, or used the Forth language, you will know instantly what this means. For the rest of us, here is a simple explanation. For a more detailed explanation, , see the CRPL Tutorial.Each CRPL instruction (term) uses one or more arguments that are on a "stack". The most recent argument on the stack will be used first.
You can place arguments on the stack by typing them, or an instruction that are executed can push arguments on to the stack. So, for instance, you can type 2 4 5 and then these three numbers are on the stack.
As an illustration, imagine you want to add two of the numbers you entered above, then the instruction to perform addition is "add," If you type "add" as your next instruction, then the instruction will read the two most recent arguments on the stack (4 and 5), add then and push the sum on to the stack. After the instruction has competed, there will be two numbers oin the stack. The "2" from your original entry, and "9" - the sum of the two arguments added by the "add" instruction.
adding comments makes code easier to unserstand, and sometimes helps the programmer or another reader to grasp complex pieces of logic. Also, after an absence, it refreshes one's mind about exctly what a certain piece of code was intended to do.
Comments in CRPL can be either a whole line or a partial line. The comment terminates when a line ends.
Comments are indicated by the "hash" character (#),
#this is a comment
2 3 add # add two numbers together
Every CRPL operand takes one or more arguments from a "stack", pushes one or more operands onto the "stacK, or does both. In order to diagram the number of arguments consumed or produced, the following notation is included in every description following:
For instance, the instruction to add two numbers are
4 5 add
Stack notation to represent this will be:
4 5 -- 9
Note:Unless explicitly noted otherwise, all instructions are destructive stack opeartions in that they will remove as many argumants as is required for their execution from the stack and replace theose with the output from their execution. In the example above, the original two items on the stack has been replaced by the sum.
Likewise, note that the most recent item pushed on to the stack will also be the first item to be removed. This is refferred to as LIFO (Last In, First Out) processing.
The following convention is followed to represent items on the stack notation
b | Boolean ; nominally a 1 or a zero, representing True or False |
i | Integer ; an integer. The CRPL run-time will, if possible, convert the argumant to an integer. |
n | Term ; a generic argument. Any term that will be accepted by the instruction. If possible, the CRPL run-time will attempt conversion between types. |
f | Float ; a floating point value. If possible, the CRPL run-time will attempt conversion between types. |
x, y | Coordinate ; an integer that represents a valid X- or Y-coordinate on the map. |
s | String ; a string of one or more text characters. If possible, numeric values will be converted at run-time. |
The following typographical conventions are used in this reference document:
Normal text | Used in most instances. |
Instruction | Refers to a CRPL language element or instruction. |
Argument | Refers to a an argument required for a CRPL instruction. | User | Refers text that should be replaces with user-supplied values. |
Once Notepad++ is installed you can add syntax hightlight for the CRPL langage by downloading this file. RIGHT CLICK AND CHOOSE SAVE AS: CRPL-syntax.xml
To install into Notepad++ select Language from the menu, then click "Defined Your Language", then "import".
You can add keyword auto completion to Notepad++ by download this file. RIGHT CLICK AND CHOOSE SAVE AS: CRPL.xml
To install into Notepad++ you need to copy CRPL.xml to your Notepad++ install directory\plugins\APIs directory. Then, restart Notepad++. Next, go to the Settings/Preferences menu in Notepad++. Click the "Backup/Auto-Completion" tab. Check the "Enable auto-completion on each input" checkbox, and make sure the "Function completion" radio button is selected.
]]>