123456789101112131415161718192021222324252627282930313233343536373839404142(**********************************************************************)(* *)(* This file is part of the FSML library *)(* github.com/jserot/fsml *)(* *)(* Copyright (c) 2020-present, Jocelyn SEROT. All rights reserved. *)(* *)(* This source code is licensed under the license found in the *)(* LICENSE file in the root directory of this source tree. *)(* *)(**********************************************************************)typet={m_name:string;m_states:stringlist;m_inps:(string*Types.t)list;m_outps:(string*Types.t)list;m_vars:(string*Types.t)list;m_init:State.t*Action.tlist;m_body:(State.t*Transition.tlist)list;(* Transitions, indexed by source state *)(* m_body = [case_1;...;case_n]
means
"while ( 1 ) { switch ( [state] ) { [case_1]; ...; [case_n] } }" *)}letmakef=letf=Typing.type_check_fsm~mono:truefinletopenFsminletsrc_statests=letrecscanaccts=matchtswith|[]->List.revacc|(src,_,_,_)::rest->ifList.memsrcaccthenscanaccrestelsescan(src::acc)restinscan[]tsin{m_name=f.id;m_states=f.states;m_inps=f.inps;m_outps=f.outps;m_vars=f.vars;m_init=f.itrans;m_body=List.map(funs->s,List.filter(fun(s',_,_,_)->s=s')f.trans)(src_statesf.trans)}