Goose  Artifact [52127463c4]

Artifact 52127463c4057c907b59a43d3d366429b52eb2fbffe709eacb119c7f4221119d:

  • File bs/sema/uni-ruleset.h — part of check-in [f764dd2384] at 2018-12-17 14:39:33 on branch trunk — Refactored unify as a generator that can yield multiple solutions, along with a score to order them. (user: achavasse size: 568)

#ifndef EMPATHY_SEMA_UNI_RULESET_H
#define EMPATHY_SEMA_UNI_RULESET_H

namespace empathy::sema
{
    class UnificationContext;

    class UnificationRuleSet
    {
        public:
            using Func = function< UniGen ( const Term& lhs, const Term& rhs, UnificationContext& ) >;

            UnificationRuleSet();

            void addRule( const Term& pat, Func f );
            void addRule( const Term& pat1, const Term& pat2, Func f );

            const auto& trie() const { return m_trie; }

        private:
            Trie< Func > m_trie;
    };
}

#endif