Programs->R2->How It Works
How It Works
Home
  What's New
  Downloads
Programs
  CSS Editor
  TCP/IP
  rInstaller
  R
  R2
    Functions
    How It Works
    Basic Types
    Reference
  Java
Publications
  ODBC Browser
  Internet Server

Red Corona
Mail me




Note: these pages use the APL2741 or APLSans font, both available from Causeway.

How R2 Works

The first important note about R2 is that it executes line by line; nothing left on the stack at the end of one line is available at the start of the next. For example, the code:
2
+2

... will give you:
2
2

... in the session. The other interesting point is that R2 uses a two-pass resolution system:

  1. Tokenisation: The string of characters comprising the line is split into tokens and placed on the stack. This results in, for example, the line qq„+/¼œ½mat being split into the name qq, a series of symbols , +, /, ¼, œ and ½, and the name mat. Any parenthesised sections are resolved immediately to a series of simple values.
  2. Execution: Each element on the stack is resolved to simple values. This means getting values for any variable names, running functions and interpreting symbols. Errors can occur at this point, and will suspend execution if they do. Functions and symbols are assigned their execution type (niladic, monadic or dyadic) according to the types of items on each side.

Errors

An error will suspend the offending function in time-honoured APL fashion. (However the results of …Œlc and …0 are not terribly good at the moment.) This (supposedly) lets you fix the problem and continue, as in other APLs.


Page and site © Richard Smith 2001
Please send any comments to richard@redcorona.com - thank you.
 Top   Home