public static <V> TreePattern<V> compile(
		final String pattern,
		final Function<? super String, ? extends V> mapper
	) {
		return new TreePattern<>(
			TreeNode.parse(pattern, v -> Decl.of(v.trim(), mapper))
		);
	}
Compiles the given tree pattern string.

@param pattern the tree pattern string
@param mapper the mapper which converts the serialized string value to
       the desired type
@param <V> the value type of the tree than can be matched by the pattern
@return the compiled pattern
@throws NullPointerException if the given pattern is {@code null}
@throws IllegalArgumentException if the given parentheses tree string
        doesn't represent a valid pattern tree or one of the variable
        names is not a valid (Java) identifier
jenetics.ext/src/main/java/io/jenetics/ext/rewriting/TreePattern.java