Example of a formula involving a complicated function
This example uses a function which takes two arguments and returns an array of results, which are identified by name. In the formula, the return value named VAL1 is being retrieved.
y*MyFunc(z,3:VAL1)
Written as an unparsed formula, each token is directly transcribed as follows:
Type | Value |
---|---|
XSLP_VAR | index of y |
XSLP_OP | XSLP_MULTIPLY |
XSLP_FUN | index of MyFunc |
XSLP_LB | 0 |
XSLP_VAR | index of z |
XSLP_DEL | XSLP_COMMA |
XSLP_CON | 3 |
XSLP_DEL | XSLP_COLON |
XSLP_STRING | index of VAL1 in string table |
XSLP_RB | 0 |
XSLP_EOF | 0 |
Written as a parsed formula (in reverse Polish), an evaluation order is established first, for example:
y ) VAL1 : 3 , z MyFunc( *
and this is then transcribed as follows:
Type | Value |
---|---|
XSLP_VAR | index of y |
XSLP_RB | 0 |
XSLP_STRING | index of VAL1 in string table |
XSLP_DEL | XSLP_COLON |
XSLP_CON | 3 |
XSLP_DEL | XSLP_COMMA |
XSLP_VAR | index of z |
XSLP_FUN | index of MyFunc |
XSLP_OP | XSLP_MULTIPLY |
XSLP_EOF | 0 |
Notice that the function arguments are in reverse order, including the name of the return value and the colon delimiter, and that a right bracket is used as a delimiter to indicate the end of the argument list.