Using JFlex and JCup tools, write a parser and evaluator for boolean expressions whose grammar is given below:
B --> O
O --> A or O | A
A --> T and A | T | not T
T --> true | false | id | '(' O ')'
Here, id is any identifier that begins with a letter and is followed by
zero or more letters or digits.
You should wrap the parser and evaluator into an interactive program
that behaves as follows:
$ java bool BOOL> P=true; BOOL> Q=true; BOOL> R1=false; BOOL> R2=true; BOOL> eval( P and Q or R1 and not R2 ); P and Q or R1 and not R2 = true BOOL> exit; $