public static void main(String[] args) throws Exception {
    BackusNaur bn = new BackusNaur(new File("resources/test.bn"));   
    HashMap<String, TreeSet<String>> res = new HashMap<String, TreeSet<String>>();
    boolean matched = bn.matches("fruit", "apple", res);
    if (matched) System.out.println("matched");
    for (String symbol : res.keySet()) {
      System.out.printf("Matches for <%s>:\n", symbol);
      TreeSet<String> matches = res.get(symbol);
      for (String match : matches) {
        System.out.println(">>> " + match);
      }
      System.out.println();
    }
  }