If we have a parser for our module enrollment language then we can write a recursive procedure for checking a student’s module choices, starting from the abstract syntax tree. The procedure takes as input a node of the tree and has as output a Boolean, i.e. the value “true” or “false”. When called on a node labelled by a module name it checks whether the student has selected the module, returning “true” if so and “false” if not. When called on a node labelled ¬ it calls itself on the node at the end of the outgoing arrow and returns “true” if that call returned “false” and vice versa. When called on a node labelled ∧ it calls itself on each of the nodes at the end of the two outgoing arrows and returns “true” if both of those calls returned “true” and “false” otherwise. When called on a node labelled ∨ it calls itself on each of the nodes at the end of the two outgoing arrows and returns “false” if both of those calls returned “false” and “true” otherwise.
Applying this procedure to the root of the abstract syntax tree for a module selection rule tells you whether the student’s module selections are allowed by the rule.
This checker works equally well regardless of whether we chose the infix, prefix or postfix version of our input language, since they all have parsers which produce the same abstract syntax tree.