@@ -0,0 +1,988 @@
+package mb.statix.spoofax;%0A%0Aimport static mb.nabl2.terms.build.TermBuild.B;%0Aimport static mb.nabl2.terms.matching.TermMatch.M;%0A%0Aimport java.util.List;%0Aimport java.util.Optional;%0A%0Aimport org.spoofax.interpreter.core.IContext;%0Aimport org.spoofax.interpreter.core.InterpreterException;%0A%0Aimport com.google.inject.Inject;%0A%0Aimport mb.nabl2.terms.ITerm;%0Aimport mb.nabl2.terms.matching.Pattern;%0A%0Apublic class STX_compare_patterns extends StatixPrimitive %7B%0A%0A    @Inject public STX_compare_patterns() %7B%0A        super(STX_compare_patterns.class.getSimpleName(), 0);%0A    %7D%0A%0A    @Override protected Optional%3C? extends ITerm%3E call(IContext env, ITerm term, List%3CITerm%3E terms)%0A            throws InterpreterException %7B%0A        return M.tuple2(StatixTerms.pattern(), StatixTerms.pattern(), (t, p1, p2) -%3E %7B%0A            return B.newInt(Pattern.leftRightOrdering.compare(p1, p2));%0A        %7D).match(term).map(Optional::of).orElseThrow(() -%3E new InterpreterException(%22Expected tuple of patterns.%22));%0A    %7D%0A%0A%7D

Add primitive to compare patterns.