docs: private static void collectTerminals(AbstractExpression expr, Set<AbstractExpression> accum) {
          if (expr != null) {
              collectTerminals(expr.getLeft(), accum);
              collectTerminals(expr.getRight(), accum);
              if (expr.getArgs() != null) {
                  expr.getArgs().forEach(e -> collectTerminals(e, accum));
              } else if (expr.getLeft() == null && expr.getRight() == null) {
                  accum.add(expr);
              }
          }
      }