code: private static NaryTree readSubtreeInPtbFormat(Reader reader) throws IOException {
          ReaderState state = ReaderState.START;
          StringBuilder symbolSb = new StringBuilder();
          ArrayList<NaryTree> children = null;
          boolean isLexical = false;
  
          char[] cbuf = new char[1];
          while (reader.read(cbuf) != -1) {
          //for (int i=0; i<treeStr.length(); i++) {
              //char c = treeStr.charAt(i);
              char c = cbuf[0];
              if (state == ReaderState.START) {
                  if (c == '(') {
                      state = ReaderState.NONTERMINAL;
                  } else if (c == ')') {
                      // This was the tail end of a tree.
                      break;
                  } else if (!isWhitespace(c)) {
                      symbolSb.append(c);
                      state = ReaderState.LEXICAL;
                      isLexical = true;
                  }
              } else if (state == ReaderState.LEXICAL) {
                  if (isWhitespace(c) || c == ')') {
                      state = ReaderState.DONE;
                      break;
                  } else {
                      symbolSb.append(c);
                  }
              } else if (state == ReaderState.NONTERMINAL) {
                  if (isWhitespace(c)) {
                      state = ReaderState.CHILDREN;
                      children = readTreesInPtbFormat(reader);
                      state = ReaderState.DONE;
                      break;
                  } else {
                      symbolSb.append(c);
                  }
              } else {
                  throw new IllegalStateException("Invalid state: " + state);
              }
          }
          if (state != ReaderState.DONE) {
              // This reader did not start with a valid PTB style tree.
              return null;
          }
          
          int start = NOT_INITIALIZED;
          int end = NOT_INITIALIZED;
          String symbol = symbolSb.toString();
          NaryTree root = new NaryTree(symbol, start, end, children, isLexical);
          return root;
      }
docs: Reads an NaryTreeNode from a string.
  
  Example:
  (NP (DT the) (NN board) )
  
  Note that the resulting tree will NOT have the start/end fields initialized.
  @param lexAlphabet TODO
  @param ntAlphabet
  @param reader
  
  @return
  @throws IOException