Example of an arithmetic formula
x2+4y(z-3)
Written as an unparsed formula, each token is directly transcribed as follows:
| Type | Value |
|---|---|
| XSLP_VAR | index of x |
| XSLP_OP | XSLP_EXPONENT |
| XSLP_CON | 2 |
| XSLP_OP | XSLP_PLUS |
| XSLP_CON | 4 |
| XSLP_OP | XSLP_MULTIPLY |
| XSLP_VAR | index of y |
| XSLP_OP | XSLP_MULTIPLY |
| XSLP_LB | 0 |
| XSLP_VAR | index of z |
| XSLP_OP | XSLP_MINUS |
| XSLP_CON | 3 |
| XSLP_RB | 0 |
| XSLP_EOF | 0 |
Written as a parsed formula (in reverse Polish), an evaluation order is established first, for example:
x 2 ^ 4 y * z 3 - * +
and this is then transcribed as follows:
| Type | Value |
|---|---|
| XSLP_VAR | index of x |
| XSLP_CON | 2 |
| XSLP_OP | XSLP_EXPONENT |
| XSLP_CON | 4 |
| XSLP_VAR | index of y |
| XSLP_OP | XSLP_MULTIPLY |
| XSLP_VAR | index of z |
| XSLP_CON | 3 |
| XSLP_OP | XSLP_MINUS |
| XSLP_OP | XSLP_MULTIPLY |
| XSLP_OP | XSLP_PLUS |
| XSLP_EOF | 0 |
Notice that the brackets used to establish the order of evaluation in the unparsed formula are not required in the parsed form.
