basic prefix calculator implementation