A sequential Monte Carlo algorithm for solving BSDEs