Design a mini compiler/interpreter | Applied Interview Question