Skip to content

Commit

Permalink
probe compiler_lib from interpreter
Browse files Browse the repository at this point in the history
  • Loading branch information
TeamSPoon committed Dec 17, 2024
1 parent 1575f90 commit 1cbc3b7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
6 changes: 3 additions & 3 deletions prolog/metta_lang/metta_compiler_lib.pl
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@


'mc__:'(Obj, Type, [':',Obj, Type]):- current_self(Self), sync_type(10, Self, Obj, Type). %freeze(Obj, get_type(Obj,Type)),!.
sync_type(D, Self, Obj, Type):- nonvar(Obj), nonvar(Type), !, arg_conform(D, Self, Obj, Type).
sync_type(D, Self, Obj, Type):- nonvar(Obj), var(Type), !, get_type(D, Self, Obj, Type).
sync_type(D, Self, Obj, Type):- nonvar(Type), var(Obj), !, set_type(D, Self, Obj, Type), freeze(Obj, arg_conform(D, Self, Obj, Type)).
sync_type(D, Self, Obj, Type):- nonvar(Type), nonvar(Obj), !, arg_conform(D, Self, Obj, Type).
sync_type(D, Self, Obj, Type):- nonvar(Type), var(Obj), !, set_type(D, Self, Obj, Type). %, freeze(Obj, arg_conform(D, Self, Obj, Type)).
sync_type(D, Self, Obj, Type):- freeze(Type,sync_type(D, Self, Obj, Type)), freeze(Obj, sync_type(D, Self, Obj, Type)),!.


'mc__get-type'(Obj,Type):- attvar(Obj),current_self(Self),!,trace,get_attrs(Obj,Atts),get_type(10, Self, Obj,Type).
%'mc__get-type'(Obj,Type):- attvar(Obj),current_self(Self),!,trace,get_attrs(Obj,Atts),get_type(10, Self, Obj,Type).
'mc__get-type'(Obj,Type):- current_self(Self), !, get_type(10, Self, Obj,Type).

%%%%%%%%%%%%%%%%%%%%% arithmetic
Expand Down
22 changes: 19 additions & 3 deletions prolog/metta_lang/metta_eval.pl
Original file line number Diff line number Diff line change
Expand Up @@ -629,14 +629,16 @@
Head=..[E20,Eq,RetType,Depth,Self,[F|Args],Res],
is_like_eval_20(E20),
clause(Head, Body),
ignore(once((sub_term(FF==Sym, Body), atom(Sym), FF == F,F=Sym))),
%min_max_args(Args,Startl,Ends),
(is_list(Args)->true;between(1,5,Len)),
once(len_or_unbound(Args,Len)),
nonvar(F),atom(F),
ignore(Depth=666),
ignore(Eq= '='),
% ignore(Eq= '='),
ignore(Self= '&self'),
get_operator_typedef(Self,F,Len,ParamTypes,RetType),
once(len_or_unbound(Args,Len)).
once(get_operator_typedef(Self,F,Len,ParamTypes,RetType)).



eval_20(Eq,RetType,_Dpth,_Slf,['repl!'],Y):- !, repl,check_returnval(Eq,RetType,Y).
Expand Down Expand Up @@ -2288,6 +2290,20 @@
as_tf(same_terms(X,Y),TF).


eval_20(_Eq,RetType,_Dpth,_Slf,[EQ|Args],TF):-
prefix_impl_preds('mc__',EQ,Len),
append(Args,[TF],PArgs),length(PArgs,Len),
atom_concat('mc__',EQ,Fn),!,
apply(Fn,PArgs).

eval_20(_Eq,RetType,_Dpth,_Slf,[EQ|Args],TF):-
prefix_impl_preds('mi__',EQ,Len),
append(Args,[TF],PArgs),length(PArgs,Len),
atom_concat('mi__',EQ,Fn),!,
apply(Fn,PArgs).



suggest_type(_RetType,_Bool).

naive_eval_args:-
Expand Down

0 comments on commit 1cbc3b7

Please sign in to comment.