Calculator that is build on finit state machine