I've coded a program (TI-BASIC, not assembly) that will take the user's input for a Boolean expression, and I need to interpret this expression to make a truth table. The user can use any of the 27 keyboard values (A-Z + θ).

I want to display a truth table of this general form:

(1)Where $\phi(p,q)$ is the user's input. I know I need to limit the variables (as, if the user used ALL 27 VARIABLES, I would need $2^{27}=134217728$ rows, a ridiculous amount), but how might I generate the truth table?

The user's input may look something like this:

`"P or Q and not(R) xor not(P)" ;this is stored in Str1`

The only rows I would need to display are $p,\ldots,\theta$ (or maybe less variables) and $\phi(\vec{v_i})$ (the user's input). I would appreciate any help on this. Thanks!