Goose  Diff

Differences From Artifact [eb8a2615e0]:

  • File bs/sema/unify.h — part of check-in [403ca496c8] at 2019-03-10 19:20:48 on branch trunk — Overloading: first untested draft of utrie unification. (user: achavasse size: 315)

To Artifact [5b0c499e2e]:

  • File bs/sema/unify.h — part of check-in [43e22af793] at 2019-08-05 02:45:01 on branch trunk —
    • Unification now works in two passes. The second pass gives unification rules a chance to match again after all the holes have been resolved and substituted.
    • Fixed many horrible bugs in various unification rules that managed to go by unnoticed until the above change, after which they made everything catch on fire.
    • Simplified the ct_int and ct_string unification rules to take advantage of the new unification behavior. Everything finally works as intended wrt to ct_int versus RT integers.
    • Removed unification callbacks. It was a system to provide a way to perform unification work post hole substitution, so it is now obsolete.
    (user: achavasse size: 742)

1
2
3
4
5
6
7








8

9
10
11
12
#ifndef EMPATHY_SEMA_UNIFY_H
#define EMPATHY_SEMA_UNIFY_H

namespace empathy::sema
{
    using UniGen = Generator< pair< Term, UnificationContext > >;









    UniGen Unify( const Term& lhs, const Term& rhs, UnificationContext& context );

    UniGen HalfUnify( const Term& lhs, UnificationContext& context );
}

#endif







>
>
>
>
>
>
>
>

>




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#ifndef EMPATHY_SEMA_UNIFY_H
#define EMPATHY_SEMA_UNIFY_H

namespace empathy::sema
{
    using UniGen = Generator< pair< Term, UnificationContext > >;

    // Perform one unification pass, or two if holes need to be substituted.
    UniGen FullUnify( const Term& lhs, const Term& rhs, UnificationContext& context );

    // If substitution is needed, perform substitution on lhs and rhs and then
    // perform a second unification pass.
    UniGen UnifyPass2( const Term& lhs, const Term& rhs, const Term& s, UnificationContext& ucPass1 );

    // Perform one unification pass
    UniGen Unify( const Term& lhs, const Term& rhs, UnificationContext& context );

    UniGen HalfUnify( const Term& lhs, UnificationContext& context );
}

#endif