Processing the Selection Equation

 

Now the problem is the processing of the selection equation. It has to be stored in the RoleDefnPtr, but it must also show up as an equation so that the equation editor can get its hands around it. Actually, it doesn't quite need an equation, just a single token symbol that it can recognize as meaning, "OK, whatever you've got left on the top of the stack tells us if this role is selected". So let's talk about that value.

 

We have the boolean operators handle all the internal magic. A boolean operator looks at the two values on the stack and returns a value that is nonzero if true, zero if false.

 

a = b =(a, b) a, b, =, Select

a „ b „(a, b) a, b, „, Select

a ¾ b ¾(a, b) a, b, ¾, Select

(a „ b) & (b < c) &(„(a, b), <(b, c)) b, c, <, a, b, „, &, Select

 

This looks good. But how will it work with the engine? I suppose that the engine will load the token string, process it up to the Select token, and if it has a nonzero value at the top of the stack, it proceeds with the rest of the token string, otherwise it skips to the next role.