package archetype
Archetype language compiler
Install
Dune Dependency
Authors
Maintainers
Sources
1.3.0.tar.gz
md5=eecc053d9379ea46d2146931cef1d2af
sha512=f807737647e370d9c830d88c4b85f27b1fdbdf83f5ee0afb80dc8ab0af3b051c432806b4d2f23da50b4c13d715b08d9aa4dab6a9aaa87acefacf2d21fb6a5fcc
doc/src/archetype/opt_model.ml.html
Source file opt_model.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
open Model open Gen_transform open Tools open Location let build_entries (model : model) : model = let p : (type_ * mterm) option = match model.functions with | [{node = Entry {args = [(_, pty, _)]; body = code}}] -> Some (pty, code) | _ -> None in let rec split (code : mterm) : (mterm * mterm) option = match code.node with | Mseq [a] -> split a | Minstrmatchor (_a, _b, c, _d, e) -> Some (c, e) | _ -> None in let process_arg t = match t with | _ -> [dumloc "arg", t, None] in let rec process (pty, code : type_ * mterm) = match pty with | Tor (o1, o2), None -> begin match split code with | Some (c1, c2) -> process (o1, c1) @ process (o2, c2) | None -> assert false end | _, Some annot -> [Some annot, pty, code] | _, _ -> [Some (dumloc "default"), pty, code] in Option.fold (fun model p -> let l = process p in let ps = List.mapi (fun k (name, pty, code) -> let name = match name with | Some x -> x | None -> dumloc (Format.asprintf "entry_%i" k) in mk_function (Entry (mk_function_struct ~args:(process_arg pty) name code)) ) l in { model with functions = ps }) model p let remove_operations_nil (model : model) : model = let rec aux ctx (mt : mterm) : mterm = match mt.node with | Massign(ValueAssign, _, Avar {pldesc = "ops"}, { node = (Mlitlist []) }) -> seq [] | _ -> map_mterm (aux ctx) mt in map_mterm_model aux model let optimize (model, env : model * 'a) = let model = model |> build_entries |> remove_operations_nil |> flat_sequence in model, env
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>