Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let rec findTransition env = function
- |(endstate, edge)::rest ->
- match edge with
- |Ass(var, aexpr) ->if (aexpr.Valid env) then (endstate, Map.add var (aexpr.Eval env) env) else findTransition env rest
- |Skip -> (endstate, env)
- |Conditional(bexpr) -> if bexpr.Eval env then (endstate, env) else findTransition env rest
- | [] -> failwith("Unable to fire any transition")
- let rec execute s g env = Map.find s g |> findTransition env |> fun (s':string,env') -> if s'.Contains "◀" then "terminated",env' else execute s g env'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement