parse_bracketed.input: taken from WASP, http://www.cs.utexas.edu/users/ml/wasp/