pushing and popping logic for parens
digit detection