123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134openDomain.LibopenLangmoduleTyp=Type.TypopenUtil.Source(* Module signatures for interpreter-extern interaction *)typemode=AL_mode|SL_mode|PL_mode|Empty_modetypespec=ALofAl.spec|SLofSl.spec|PLofPl.spec|Empty(* Result types *)typerel_result=PassofValue.tlist|Failofregion*stringtypefunc_result=PassofValue.t|Failofregion*stringtypeparse_result=PassofValue.t|Failof[`Syntaxofregion*string]typeprogram_result=|PassofValue.tlist|Failof[`Syntaxofregion*string|`Runtimeofregion*string]typestf_result=|Pass|Failof[`Syntaxofregion*string|`Runtimeofregion*string](* Cache management *)moduletypeCACHE=sigvalcache_on:unit->unitvalcache_off:unit->unitend(* Interface for the interaction between SpecTec and the defined language *)moduletypeINTERFACE=sig(* Program parsing, into IL value *)valparse_program:stringlist->stringlist->parse_resultvalparse_string:string->string->parse_result(* Program unparsing *)valunparse_program:Value.t->string(* Builtins *)valcall_builtin:(Value.t->unit)->Id.t->Typ.tlist->Value.tlist->Value.t(* State management *)valcheckpoint:unit->intvalseff:int->int->bool(* Initialization *)valinit:spec->unitend(* Interface for the interaction between SpecTec and external code *)moduletypeEXTERN=sigmoduleCache:CACHE(* Extern relation and meta-function evaluation *)valeval_extern_rel:string->Value.tlist->rel_resultvaleval_extern_func:string->Typ.tlist->Value.tlist->func_result(* State management *)valcheckpoint:unit->intvalseff:int->int->boolvalclear:unit->unit(* Mode initialization for interp-extern knot *)valinit_mode:mode->unitend(* SpecTec interperter(s) *)moduletypeINTERP=sigmoduleCache:CACHE(* Relation and meta-function evaluation *)valeval_program:string->stringlist->string->program_resultvaleval_rel:string->Value.tlist->rel_resultvaleval_func:string->Typ.tlist->Value.tlist->func_result(* Clear the state *)valclear:unit->unitendmoduletypeINTERP_AL=sigincludeINTERP(* Initialization *)valinit:cache:bool->det:bool->guard:bool->Al.spec->unitendmoduletypeINTERP_SL=sigincludeINTERP(* Initialization *)valinit:cache:bool->det:bool->guard:bool->Sl.spec->unitendmoduletypeINTERP_PL=sigincludeINTERP(* Initialization *)valinit:cache:bool->det:bool->guard:bool->Pl.spec->unitend(* Runner for SpecTec, which glues together the interface, the extern, and the interpreter *)moduletypeRUNNER=sigmoduleCache:CACHEmoduleInterface:INTERFACEmoduleInterp:INTERP(* Initialization *)valinit:?cache:bool->?det:bool->?guard:bool->spec->unit(* Clear the state *)valclear:unit->unitend