Monadic Parser in Java