links from


Webb - all rights reserved - ©2004
RPN has a much higher level programming language than previously documented.

Here's an example of the new programming style that became available in v3.00 but was undocumented until now.  The advantage of it not being documented is now we know it didn't break old scripts and most people have upgraded so scripts using the new features will not cause confusion.

[double] top.make
     top top +
"New Code"
"test" 4.12 double ;

New features:
    * use RPN.3 to enable new coding style
    * subroutines can have long names
    * you can call subroutines by long names (>1 character)
    * literal numbers can be put directly into the code
    * you can make locals using 'name.make'
    * you can get locals just using their name, see 'top' above
    * you can set a locals using 'name.set' in your code

All these new features require 'words' to be separated by whitespace.  32+1 will still be treated as bytecodes while 32 + 1 will be treated as tokens.  There may be some odd problems converting your script directly to RPN.3 sytle, but they should be very rare.  Something like '3.0' in your code would have meant
1. put 3 on the stack
2. abort the program
3. put 0 on the stack
Now it means put 3.0 on the stack.

How does it all work?  Spaces used to removed from scripts.  Now they aren't.  Each space is now its own bytecode that grabs the next word of input and successively tries to treat it as a subroutine, literal number, and only then as bytecode.  Subroutines and literal numbers have to be longer than 1 character in length for ease of porting.  Of course the 0-9 numbers always were treated as bytecode literals so that's no problem, and since subroutines used to have single character names, it's impossible for old code that works to be calling a subroutine that looks like a multi-character subroutine name in the new style.  Fairly slick and useful.

0.0229 secs

top of page

Webb - all rights reserved - ©2004
powered by Spinneret 0.10