123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198(****************************************************************************)(* *)(* This file is part of MOPSA, a Modular Open Platform for Static Analysis. *)(* *)(* Copyright (C) 2017-2019 The MOPSA Project. *)(* *)(* This program is free software: you can redistribute it and/or modify *)(* it under the terms of the GNU Lesser General Public License as published *)(* by the Free Software Foundation, either version 3 of the License, or *)(* (at your option) any later version. *)(* *)(* This program is distributed in the hope that it will be useful, *)(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)(* GNU Lesser General Public License for more details. *)(* *)(* You should have received a copy of the GNU Lesser General Public License *)(* along with this program. If not, see <http://www.gnu.org/licenses/>. *)(* *)(****************************************************************************)(** Syntax tree of configuration files *)openSig.Abstraction.StackedopenSig.Abstraction.DomainopenSig.Abstraction.SimplifiedopenSig.Abstraction.Simplified_functoropenSig.Abstraction.StatelessopenSig.Abstraction.PartitioningopenSig.Abstraction.ValueopenSig.Abstraction.Value_functoropenSig.Reduction.ExecopenSig.Reduction.EvalopenSig.Reduction.ValueopenSig.Reduction.SimplifiedopenFormattypeabstraction={domain:domain;language:string;}anddomain={domain_kind:domain_kind;domain_semantic:stringoption;}anddomain_kind=|D_stackedof(moduleSTACKED)|D_domainof(moduleDOMAIN)|D_simplifiedof(moduleSIMPLIFIED)|D_statelessof(moduleSTATELESS)|D_functorofdomain_functor*domain|D_nonrelofvalue|D_switchofdomainlist|D_composeofdomainlist|D_productofdomainlist*domain_reductionlistanddomain_functor=|F_simplifiedof(moduleSIMPLIFIED_FUNCTOR)|F_stackedofdomain|F_partitioningof(modulePARTITIONING)andvalue=|V_valueof(moduleVALUE)|V_functorofvalue_functor*value|V_unionofvaluelist|V_productofvaluelist*value_reductionlistandvalue_functor=(moduleVALUE_FUNCTOR)anddomain_reduction=|DR_execof(moduleEXEC_REDUCTION)|DR_evalof(moduleEVAL_REDUCTION)|DR_simplifiedof(moduleSIMPLIFIED_REDUCTION)andvalue_reduction=(moduleVALUE_REDUCTION)letmk_domain?(semantic=None)kind={domain_kind=kind;domain_semantic=semantic}letpp_value_reductionfmt(r:value_reduction)=letmoduleR=(valr)inpp_print_stringfmtR.nameletpp_domain_reductionfmt=function|DR_execr->letmoduleR=(valr)inpp_print_stringfmtR.name|DR_evalr->letmoduleR=(valr)inpp_print_stringfmtR.name|DR_simplifiedr->letmoduleR=(valr)inpp_print_stringfmtR.nameletrecpp_valuefmt=function|V_valuev->letmoduleV=(valv)inpp_print_stringfmtV.name|V_functor(f,v)->letmoduleF=(valf)infprintffmt"%s(%a)"F.namepp_valuev|V_unionvl->fprintffmt"(%a)"(pp_print_list~pp_sep:(funfmt()->pp_print_stringfmt" ∪ ")pp_value)vl|V_product(vl,[])->fprintffmt"(%a)"(pp_print_list~pp_sep:(funfmt()->pp_print_stringfmt" ∩ ")pp_value)vl|V_product(vl,rl)->fprintffmt"(%a ↓ %a)"(pp_print_list~pp_sep:(funfmt()->pp_print_stringfmt" ∩ ")pp_value)vl(pp_print_list~pp_sep:(funfmt()->pp_print_stringfmt" | ")pp_value_reduction)rlletrecpp_domain_functorfmt=function|F_stackedf->pp_domainfmtf|F_simplifiedf->letmoduleF=(valf)inpp_print_stringfmtF.name|F_partitioningf->letmoduleF=(valf)inpp_print_stringfmtF.nameandpp_domainfmtd=matchd.domain_semanticwith|None->pp_domain_kindfmtd.domain_kind|Somesemantic->fprintffmt"[%s] %a"semanticpp_domain_kindd.domain_kindandpp_domain_kindfmt=function|D_stackedd->letmoduleD=(vald)inpp_print_stringfmt("[S]"^D.name)|D_domaind->letmoduleD=(vald)inpp_print_stringfmt("[D]"^D.name)|D_simplifiedd->letmoduleD=(vald)inpp_print_stringfmt("[L]"^D.name)|D_statelessd->letmoduleD=(vald)inpp_print_stringfmt("[U]"^D.name)|D_functor(f,d)->fprintffmt"%a(%a)"pp_domain_functorfpp_domaind|D_nonrelv->fprintffmt"nonrel(%a)"pp_valuev|D_switchdl->fprintffmt"(%a)"(pp_print_list~pp_sep:(funfmt()->pp_print_stringfmt" ; ")pp_domain)dl|D_composedl->fprintffmt"(%a)"(pp_print_list~pp_sep:(funfmt()->pp_print_stringfmt" o ")pp_domain)dl|D_product(dl,[])->fprintffmt"(%a)"(pp_print_list~pp_sep:(funfmt()->pp_print_stringfmt" ∧ ")pp_domain)dl|D_product(dl,rl)->fprintffmt"(%a ↓ %a)"(pp_print_list~pp_sep:(funfmt()->pp_print_stringfmt" ∧ ")pp_domain)dl(pp_print_list~pp_sep:(funfmt()->pp_print_stringfmt" | ")pp_domain_reduction)rl