Page Menu
Home
Xreate
Search
Configure Global Search
Log In
Docs
Questions
Repository
Issues
Patches
Internal API
Files
F2730916
containers.lp
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Mar 14, 2:06 AM
Size
2 KB
Mime Type
text/plain
Expires
Mon, Mar 16, 2:06 AM (1 d, 12 h)
Engine
blob
Format
Raw Data
Handle
243072
Attached To
rXR Xreate
containers.lp
View Options
%defines
impl(solid; on_the_fly; linked_list).
op(seqaccess; randaccess).
relation(recommends; satisfied; unsupported).
relation_score(satisfied, 0).
relation_score(recommends, 1).
relation_score(unsupported, -1).
score(-1..1).
%domain facts:
relation_op(seqaccess, on_the_fly, recommends).
relation_op(randaccess, solid, recommends).
relation_op(randaccess, on_the_fly, unsupported).
%dfa analysis:
%scheme: dfa_connection(Vto, Vfrom, proto);
%-- dfa_connection(VTo, VFrom, alias);
%-- dfa_connection(VFormal, VActual, arg);
%-- dfa_connection(VActual, VFormal, ret)
%compilation:
%--
%domain rules:
%aliases:
var_origin(VAR) :- not dfa_connection(VAR, _, alias), v(VAR).
var_alias(VAR0, VAR_TO) :- dfa_connection(VAR_TO, VAR0, alias), var_origin(VAR0).
var_alias(VAR0, VAR_TO2) :- dfa_connection(VAR_TO2, VAR_TO1, alias), var_alias(VAR0, VAR_TO1).
var_alias(VAR0, VAR0):- var_origin(VAR0).
%prototypes:
var_proto(V0, Vproto) :- var_origin(V0); var_origin(Vproto); var_alias(Vproto, Vp); dfa_connection(V0, Vp, proto).
%implementations:
-impl_fulfill(OP, IMPL) :- relation_op(OP, IMPL, unsupported).
impl_fulfill(OP, IMPL, SCORE):- SCORE = #sum{SCORE1, (OP, IMPL, RL): relation_op(OP, IMPL, RL),relation_score(RL, SCORE1)}
; op(OP); impl(IMPL); not -impl_fulfill(OP, IMPL).
-var_impl_fulfill(Var0, Impl) :- var_alias(Var0, Var_Any); bind(Var_Any, op(Op)); -impl_fulfill(Op, Impl).
var_impl_fulfill(VAR0, IMPL, Score) :-
Score = #sum{SCORE, (OP, IMPL, VAR_ANY): impl_fulfill(OP, IMPL, SCORE), var_alias(VAR0, VAR_ANY), bind(VAR_ANY, op(OP))}
; bind(VAR0, impl(IMPL)); var_origin(VAR0); not -var_impl_fulfill(VAR0, IMPL).
%transfunction implementation:
%bind(Vactual, op(Op)) :- var_alias(Vformal, V1); bind(V1, op(Op)); dfa_connection(Vformal, Vactual, arg); op(Op).
%bind(Vactual, op(Op)) :- var_alias(VO, Vformal); var_alias(VO, V); bind(V, op(Op)); dfa_connection(Vactual,Vformal, ret); op(Op).
% --uncomment to add possible implementations(impl) to an actual var
%bind(Vres, op(Op)) :- var_alias(VO, VA); bind(VA, op(Op)); dfa_connection(VArg,VO, result); op(Op).
%optimization
% #maximize {SCORE, (VAR0, IMPL) : var_impl_fulfill(VAR0, IMPL, SCORE)}.
#show var_alias/2.
#show var_impl_fulfill/3.
#show proto_alias2.
Event Timeline
Log In to Comment