Implementation of reverse polish calculator using stacks