private static LoopTree parseLoop(SourceInputStream in)
			throws IOException, ParseException {
		LoopTree loop = new LoopTree(in.position());
		List<Tree> children = loop.getChildren();
		in.read(); // skip [
		int ch = in.read();
		while (ch != ']') {
			in.backup();
			switch (ch) {
				case '+':
				case '-':
					children.add(parseInc(in));
					break;
				case '<':
				case '>':
					children.add(parseMove(in));
					break;
				case ',':
					children.add(new GetCharTree(in.position()));
					in.read();
					break;
				case '.':
					children.add(new PutCharTree(in.position()));
					in.read();
					break;
				case '[':
					children.add(parseLoop(in));
					break;
				case -1:
					throw new ParseException(" [ without matching ]", loop.getSourcePosition());
				default:
					in.read();
			}
			ch = in.read();
		}
		return loop;
	}