describe
the goal of the program you want to generate is to evaluate Boolean expressions, as follows:
expression: (V | V) & F & (F | V)
where V is for True,F and for False. The expression may include the following operators: for not,&for and, | for or, operation grouping with parentheses is also allowed.
to perform the evaluation of an expression, it will be treated as the precedence of the operator and does not have the highest, lowest, or lowest. The program must generate V or F as the result of each expression in the input file.
input
expressions have variable length, but never exceed 100 symbols. Symbols can be separated by any number of spaces or no spaces at all, so the total length of the expression, such as multiple characters, is unknown.
input file is variable and will never be greater than 20. Each expression is displayed as a new line, as shown below.
output
for each test expression, print "expression" followed by its sequence number ":" and the resulting value of the corresponding test expression. Separate the output of the continuous test expression with a new line.
use the same format as shown in the sample output shown below.
sample input
(V | V) & F & (F | V)
! V | Vending Velocity! F & (F | V) & (! F | F |! Vault V)
(Fairf | V |! Vogue F & (F |! )
sample output
expression 1 br F
expression 2 br V
expression 3