I've have a String

String s = " ~ ( A || B ) && C ";

A B C can take 0,1,x

they follow Boolean Arithmetic

w.r.t 'x' Boolean Arith is as follows

0 || x = x

1 || x = 1

x || x =1

x && 0 = 0

x && x = x

x && 1 = x

~ x = x

Now I've A = 1 B = x C = x ;

and I want to evaluate String "s: to get Output boolean value (i.e 1,0,x ) .

Currently I'm thinking of Shunting Yard Alogo to create the string from infix to posix notiation and

use each operator from stack to process the boolean expressions but this would be 100+ lines and overkill

So wanted to know if there is anyother way to implement this !!