Sample Run

$ python3 WAE.py 
WAE: 2.5;

The value is 2.5

WAE: x;

EVALUATION ERROR: Undefined Variable: x

WAE: {2};

Syntax error in input!

WAE: {x};

Syntax error in input!

WAE: {+ 2 2};

The value is 4.0

WAE: {- 4 2};

The value is 2.0

WAE: {/ 9 {- 2 2}};

EVALUATION ERROR: Divide by zero!

WAE: {+ {+ {+ 2 3} {+ 4 5}} {+ 5 7}};

The value is 26.0

WAE: {+ x 2};

EVALUATION ERROR: Undefined Variable: x

WAE: {if {+ 2 2} 3 {+ 4 5}};

The value is 3.0

WAE: {if {- 2 2} 3 {+ 4 5}};

The value is 9.0

WAE: {with {{x {with {{y 3}} {+ y y}}}} {+ x x}};

The value is 12.0

WAE: {with {{x {with {{x {with {{y 3}} {+ y y}}}} {+ x x}}}}  {+ x 2} };

The value is 14.0

WAE: {with {{x 3}{y 2}{x 9}} {+ x y}};

EVALUATION ERROR: Duplicate variable in with-clause!

WAE: {with {{x 3}} {with {{y 4}} {with {{z 5}} {+ x {+ y z}} } } };

The value is 12.0

WAE: {with {{x 3} {y 4} {z 5}} {+ x {+ y z}}};

The value is 12.0

WAE: {with {{x 1}} {with {{x 2}} {with {{x 3}} {+ x x}}}};

The value is 6.0

WAE: {+ a a a};

Syntax error in input!

WAE: {+ 3 3 3};

Syntax error in input!

WAE: {with {{x 3}} {with {{y 4}} {+y z}};

Syntax error in input!

WAE: {with {{x 20}{y 30}} 
      {with {{x 40}{z {+ x y}}}
            {with {{u {* x {* x y}}}}
                  {+ x {* y {+ u z}}}
            }
      }
};

The value is 1441540.0

WAE: exit;
$