// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
#include <iostream>

using namespace std;

#include "expr.h"

int main()
{
   BoolExpression e1("TRUE AND FALSE");
   BoolExpression e1x = infix2postfix(e1);
   cout << e1x.Value() << endl;
   BoolExpression e2("TRUE OR FALSE");
   BoolExpression e2x = infix2postfix(e2);
   cout << e2x.Value() << endl;
   BoolExpression e3("NOT((TRUE OR FALSE) AND (FALSE OR FALSE))");
   BoolExpression e3x = infix2postfix(e3);
   cout << e3x.Value() << endl;
   BoolExpression e4("NOT((1 EQUAL 1 OR 1 EQUAL 2) AND (1 EQUAL 3 OR 1 EQUAL 4))");
   BoolExpression e4x = infix2postfix(e4);
   cout << e4x.Value() << endl;
   ExprDefineVariable("a",1);
   ExprDefineVariable("b",9);
   BoolExpression e5("(a EQUAL 1 AND b EQUAL 2) OR (NOT (a EQUAL 0) OR b EQUAL 9)");
   BoolExpression e5x = infix2postfix(e5);
   cout << e5x.Value() << endl;
   return 0;
}
