text
stringlengths 0
601k
|
---|
let next str ofs = if ofs < 0 || ofs >= String . length str then raise Out_of_bounds else unsafe_next str ofs |
let extract_next str ofs = if ofs < 0 || ofs >= String . length str then raise Out_of_bounds else unsafe_extract_next str ofs |
let prev str ofs = if ofs <= 0 || ofs > String . length str then raise Out_of_bounds else unsafe_prev str ofs |
let extract_prev str ofs = if ofs <= 0 || ofs > String . length str then raise Out_of_bounds else unsafe_extract_prev str ofs |
let alphabetic = UCharInfo . load_property_tbl ` Alphabetic |
let escaped_char ch = match UChar . code ch with | 7 -> " \\ a " | 8 -> " \\ b " | 9 -> " \\ t " | 10 -> " \\ n " | 11 -> " \\ v " | 12 -> " \\ f " | 13 -> " \\ r " | 27 -> " \\ e " | 92 -> " " \\\\ | code when code >= 32 && code <= 126 -> String . make 1 ( Char . chr code ) code | _ when UCharTbl . Bool . get alphabetic ch -> singleton ch | code when code <= 127 -> Printf . sprintf " \\ x % 02x " code | code when code <= 0xffff -> Printf . sprintf " \\ u % 04x " code | code -> Printf . sprintf " \\ U % 06x " code |
let add_escaped_char buf ch = match UChar . code ch with | 7 -> Buffer . add_string buf " \\ a " | 8 -> Buffer . add_string buf " \\ b " | 9 -> Buffer . add_string buf " \\ t " | 10 -> Buffer . add_string buf " \\ n " | 11 -> Buffer . add_string buf " \\ v " | 12 -> Buffer . add_string buf " \\ f " | 13 -> Buffer . add_string buf " \\ r " | 27 -> Buffer . add_string buf " \\ e " | 92 -> Buffer . add_string buf " " \\\\ | code when code >= 32 && code <= 126 -> Buffer . add_char buf ( Char . chr code ) code | _ when UCharTbl . Bool . get alphabetic ch -> add buf ch | code when code <= 127 -> Printf . bprintf buf " \\ x % 02x " code | code when code <= 0xffff -> Printf . bprintf buf " \\ u % 04x " code | code -> Printf . bprintf buf " \\ U % 06x " code |
let escaped str = let buf = Buffer . create ( String . length str ) str in iter ( add_escaped_char buf ) buf str ; Buffer . contents buf |
let add_escaped buf str = iter ( add_escaped_char buf ) buf str |
let add_escaped_string buf enc str = match try Some ( CharEncoding . recode_string ~ in_enc : enc ~ out_enc : CharEncoding . utf8 str ) str with CharEncoding . Malformed_code -> None with | Some str -> add_escaped buf str | None -> String . iter ( function | ' \ x20 ' . . ' \ x7e ' as ch -> Buffer . add_char buf ch | ch -> Printf . bprintf buf " \\ y % 02x " ( Char . code ch ) ch ) ch str |
let escaped_string enc str = let buf = Buffer . create ( String . length str ) str in add_escaped_string buf enc str ; Buffer . contents buf |
module Convert ( ConvertUS : UnicodeString . Type ) Type = struct let of_list l = let buf = US . Buf . create 0 in let rec convert l = match l with | [ ] -> ( ) | c :: tl -> US . Buf . add_char buf c ; convert tl in convert l ; US . Buf . contents buf let of_array a = let buf = US . Buf . create 0 in for i = 0 to Array . length a - 1 do US . Buf . add_char buf a ( . i ) i done ; US . Buf . contents buf let to_uChars us = let first = US . first us and last = US . last us in let length = US . length us in let rec create acc i = if US . compare_index us i first >= 0 then create ( US . look us i :: acc ) acc ( US . prev us i ) i else acc in if length > 0 then create [ ] last else [ ] end |
let array_rev a = let len = Array . length a - 1 in Array . init len ( fun i -> a ( . len - i ) i ) i |
let rec list_compare ( ? compare = compare ) compare l1 l2 = match l1 , l2 with | [ ] , [ ] -> 0 | [ ] , _ -> - 1 | _ , [ ] -> 1 | h1 :: t1 , h2 :: t2 -> match compare h1 h2 with | 0 -> list_compare ~ compare t1 t2 | _ as r -> r |
let array_compare ( ? compare = compare ) compare a1 a2 = let len1 = Array . length a1 and len2 = Array . length a2 in let rec compare_aux pos = let remain1 = len1 - pos and remain2 = len2 - pos in if remain1 <= 0 && remain2 <= 0 then 0 else if remain1 <= 0 && remain2 > 0 then - 1 else if remain1 > 0 && remain2 <= 0 then 1 else match compare a1 ( . pos ) pos a2 ( . pos ) pos with | 0 -> compare_aux ( pos + 1 ) 1 | _ as r -> r in compare_aux 0 |
let compile file = Modules . clear ( ) ; if ! no_stdlib then set_no_stdlib ( ) ; if Filename . check_suffix file " . zls " || Filename . check_suffix file " . zlus " then let filename = Filename . chop_extension file in let modname = String . capitalize_ascii ( Filename . basename filename ) in compile modname filename else if Filename . check_suffix file " . zli " then let filename = Filename . chop_suffix file " . zli " in let modname = String . capitalize_ascii ( Filename . basename filename ) in interface modname filename else if Filename . check_suffix file " . mli " then let filename = Filename . chop_suffix file " . mli " in let modname = String . capitalize_ascii ( Filename . basename filename ) in scalar_interface modname filename else raise ( Arg . Bad ( " don ' t know what to do with " ^ file ) ) |
let build file = Deps_tools . add_to_load_path Filename . current_dir_name ; let rec _build acc file = let deps = match ( Filename . extension file ) with | " . zls " -> Deps_tools . zls_dependencies file | " . zli " -> Deps_tools . zli_dependencies file | _ -> raise ( Arg . Bad ( " don ' t know what to do with " ^ file ) ) in let acc = List . fold_left _build acc deps in let basename = Filename . chop_extension file in if not ( SS . mem basename acc ) then begin compile file ; SS . add basename acc end else acc in ignore ( _build ( SS . empty ) file ) |
let doc_verbose = " \ t Set verbose mode " |
let doc_vverbose = " \ t Set even more verbose mode " " < node > \ t Simulates the node < node > and generates a file < out . > ml \ n \ \ t \ t where < out > is equal to the argument of - o if the flag \ n \ \ t \ t has been set , or < node > otherwise " " \ t Use lablgtk2 interface . " |
let errmsg = " Options are " : |
let set_verbose ( ) = verbose := true ; Printexc . record_backtrace true |
let set_vverbose ( ) = vverbose := true ; set_verbose ( ) |
let add_include d = Deps_tools . add_to_load_path d ; load_path := d :: ! load_path |
let set_gtk ( ) = use_gtk := true ; match ! load_path with | [ stdlib ] -> add_include ( stdlib ^ " - gtk " ) | _ -> ( ) |
let main ( ) = try Arg . parse ( Arg . align [ " - v " , Arg . Unit set_verbose , doc_verbose ; " - vv " , Arg . Unit set_vverbose , doc_vverbose ; " - version " , Arg . Unit show_version , doc_version ; " - o " , Arg . String set_outname , doc_outname ; " - I " , Arg . String add_include , doc_include ; " - i " , Arg . Set print_types , doc_print_types ; " - ic " , Arg . Set print_causality_types , doc_print_causality_types ; " - ii " , Arg . Set print_initialization_types , doc_print_initialization_types ; " - where " , Arg . Unit locate_stdlib , doc_locate_stdlib ; " - stdlib " , Arg . String set_stdlib , doc_stdlib ; " - nostdlib " , Arg . Set no_stdlib , doc_no_stdlib ; " - typeonly " , Arg . Set typeonly , doc_typeonly ; " - s " , Arg . String set_simulation_node , doc_simulation ; " - sampling " , Arg . Float set_sampling_period , doc_sampling ; " - check " , Arg . Int set_check , doc_check ; " - gtk2 " , Arg . Unit set_gtk , doc_use_gtk ; " - dzero " , Arg . Set dzero , doc_dzero ; " - nocausality " , Arg . Set no_causality , doc_nocausality ; " - nopt " , Arg . Set no_opt , doc_no_opt ; " - nodeadcode " , Arg . Set no_deadcode , doc_no_deadcode ; " - noinit " , Arg . Set no_initialisation , doc_noinitialisation ; " - inline " , Arg . Int set_inlining_level , doc_inlining_level ; " - inlineall " , Arg . Set inline_all , doc_inline_all ; " - nosimplify " , Arg . Set no_simplify_causality_type , doc_nosimplify ; " - noreduce " , Arg . Set no_reduce , doc_noreduce ; " - zsign " , Arg . Set zsign , doc_zsign ; " - copy " , Arg . Set with_copy , doc_with_copy ; " - lmm " , Arg . String set_lmm_nodes , doc_lmm ; " - rif " , Arg . Set use_rif , doc_rif ; " - deps " , Arg . Set build_deps , doc_deps ; ] ) ( fun filename -> if ! build_deps then build filename else compile filename ) errmsg ; begin match ! simulation_node with | Some ( name ) -> Simulator . main ! outname name ! sampling_period ! number_of_checks ! use_gtk | _ -> ( ) end with | Zmisc . Error -> exit 2 ; ; |
type kind = S | A | C | D | AD | AS | P |
type ' a localized = { desc : ' a ; loc : Zlocation . location } |
type type_expression = type_expression_desc localized | Etypevar of string | Etypeconstr of Lident . t * type_expression list | Etypetuple of type_expression list | Etypevec of type_expression * size | Etypefun of kind * Zident . t option * type_expression * type_expression | Sconst of int | Sglobal of Lident . t | Sname of Zident . t | Sop of size_op * size * size |
type interface = interface_desc localized | Einter_open of name | Einter_typedecl of name * name list * type_decl | Einter_constdecl of name * type_expression | Eabstract_type | Eabbrev of type_expression | Evariant_type of constr_decl list | Erecord_type of ( name * type_expression ) list | Econstr0decl of name | Econstr1decl of name * type_expression list | Eopen of name | Etypedecl of name * name list * type_decl | Econstdecl of name * is_static * exp | Efundecl of name * funexp { f_kind : kind ; f_atomic : is_atomic ; f_args : pattern list ; f_body : exp ; mutable f_env : Deftypes . tentry Zident . Env . t ; f_loc : location } { mutable e_desc : desc ; e_loc : location ; mutable e_typ : Deftypes . typ ; mutable e_caus : Defcaus . tc ; mutable e_init : Definit . ti ; } | Elocal of Zident . t | Eglobal of { lname : Lident . t ; typ_instance : Deftypes . typ_instance } | Econst of immediate | Econstr0 of Lident . t | Econstr1 of Lident . t * exp list | Elast of Zident . t | Eapp of app * exp * exp list | Eop of op * exp list | Etuple of exp list | Erecord_access of exp * Lident . t | Erecord of ( Lident . t * exp ) list | Erecord_with of exp * ( Lident . t * exp ) list | Etypeconstraint of exp * type_expression | Epresent of exp present_handler list * exp option | Ematch of total ref * exp * exp match_handler list | Elet of local * exp | Eseq of exp * exp | Eperiod of exp period | Eblock of eq list block * exp | Efby | Eunarypre | Eifthenelse | Eminusgreater | Eup | Einitial | Edisc | Ehorizon | Etest | Eaccess | Eupdate | Eslice of size * size | Econcat | Eatomic { p_phase : ' a option ; p_period : ' a } { mutable p_desc : pdesc ; p_loc : location ; mutable p_typ : Deftypes . typ ; mutable p_caus : Defcaus . tc ; mutable p_init : Definit . ti ; } | Ewildpat | Econstpat of immediate | Econstr0pat of Lident . t | Econstr1pat of Lident . t * pattern list | Etuplepat of pattern list | Evarpat of Zident . t | Ealiaspat of pattern * Zident . t | Eorpat of pattern * pattern | Erecordpat of ( Lident . t * pattern ) list | Etypeconstraintpat of pattern * type_expression { eq_desc : eqdesc ; eq_loc : location ; eq_index : int ; eq_safe : bool ; mutable eq_write : Deftypes . defnames ; } | EQeq of pattern * exp | EQder of Zident . t * exp * exp option * exp present_handler list | EQinit of Zident . t * exp | EQnext of Zident . t * exp * exp option | EQpluseq of Zident . t * exp | EQautomaton of is_weak * state_handler list * state_exp option | EQpresent of eq list block present_handler list * eq list block option | EQmatch of total ref * exp * eq list block match_handler list | EQreset of eq list * exp | EQemit of Zident . t * exp option | EQblock of eq list block | EQand of eq list | EQbefore of eq list | EQforall of forall_handler { b_vars : vardec list ; b_locals : local list ; b_body : ' a ; b_loc : location ; mutable b_env : Deftypes . tentry Zident . Env . t ; mutable b_write : Deftypes . defnames } { vardec_name : Zident . t ; vardec_default : Deftypes . constant default option ; vardec_combine : Lident . t option ; vardec_loc : location ; } | Init of ' a | Default of ' a { l_rec : is_rec ; l_eq : eq list ; mutable l_env : Deftypes . tentry Zident . Env . t ; l_loc : location } { s_loc : location ; s_state : statepat ; s_body : eq list block ; s_trans : escape list ; mutable s_env : Deftypes . tentry Zident . Env . t ; mutable s_reset : bool } | Estate0pat of Zident . t | Estate1pat of Zident . t * Zident . t list | Estate0 of Zident . t | Estate1 of Zident . t * exp list { e_cond : scondpat ; e_reset : bool ; e_block : eq list block option ; e_next_state : state_exp ; mutable e_env : Deftypes . tentry Zident . Env . t ; mutable e_zero : bool } | Econdand of scondpat * scondpat | Econdor of scondpat * scondpat | Econdexp of exp | Econdpat of exp * pattern | Econdon of scondpat * exp { m_pat : pattern ; m_body : ' a ; mutable m_env : Deftypes . tentry Zident . Env . t ; m_reset : bool ; mutable m_zero : bool ; } { p_cond : scondpat ; p_body : ' a ; mutable p_env : Deftypes . tentry Zident . Env . t ; mutable p_zero : bool } { for_index : indexes_desc localized list ; for_init : init_desc localized list ; for_body : eq list block ; mutable for_in_env : Deftypes . tentry Zident . Env . t ; mutable for_out_env : Deftypes . tentry Zident . Env . t ; for_loc : location } | Einput of Zident . t * exp | Eoutput of Zident . t * Zident . t | Eindex of Zident . t * exp * exp | Einit_last of Zident . t * exp |
let matmult_complex = kern cva cvb cvc n -> let mul = fun c d -> { re = c . re . * d . re . - c . im . * d . im ; im = c . im . * d . re . + c . re . * d . im ; } in let add = fun c d -> { re = c . re . + d . re ; im = c . im . + d . im ; } in let open Std in let row = thread_idx_y + block_dim_y * block_idx_y in let col = thread_idx_x + block_dim_x * block_idx_x in let mutable sum = { re = 0 . ; im = 0 . } in if row < n && col < n then ( for i = 0 to n - 1 do sum := add sum ( mul cva . [ < row * n + i ] > cvb . [ < i * n + col ] ) ; > done ; cvc . [ < row * n + col ] > <- sum ) else ( ) |
let devid = try int_of_string Sys . argv . ( 1 ) with _ -> 1 |
let cpt = ref 0 |
let tot_time = ref 0 . |
let measure_time f s = let t0 = Unix . gettimeofday ( ) in let a = f ( ) in let t1 = Unix . gettimeofday ( ) in Printf . printf " % s : time % d : % Fs \ n " %! s ! cpt ( t1 . - t0 ) ; tot_time := ! tot_time . + ( t1 . - t0 ) ; incr cpt ; a ; ; |
let mul = fun c d -> { re = c . re . * d . re . - c . im . * d . im ; im = c . im . * d . re . + c . re . * d . im ; } |
let add = fun c d -> { re = c . re . + d . re ; im = c . im . + d . im ; } |
type lol = mutable xim : float ; mutable yre : float ; mutable yim : float ; } |
let cpu_compute xc yc zc ( ) = let sum = ref { re = 0 . ; im = 0 . } in for row = 0 to n - 1 do for col = 0 to n - 1 do sum := { re = 0 . ; im = 0 . } ; for i = 0 to n - 1 do let l = { xre = xc . ( row * n + i ) . re ; xim = xc . ( row * n + i ) . im ; yre = yc . ( i * n + col ) . re ; yim = yc . ( i * n + col ) . im ; } in sum := { re = ! sum . re . + ( l . xre . * l . yre . - l . xim . * l . yim ) ; im = ! sum . im . + ( l . xim . * l . yre . + l . xre . * l . yim ) } done ; zc . ( row * n + col ) <- ! sum done done |
let _ = let devs = Devices . init ( ) in let dev = devs . ( devid ) in let block_size = 4 in Printf . printf " Dev is % s \ n " devs . ( devid ) . Devices . general_info . Devices . name ; let x = Vector . create ( Vector . Custom customComplex ) ( n * n ) and y = Vector . create ( Vector . Custom customComplex ) ( n * n ) and z = Vector . create ( Vector . Custom customComplex ) ( n * n ) and xc = Array . create ( n * n ) { re = 0 . ; im = 0 . } and yc = Array . create ( n * n ) { re = 0 . ; im = 0 . } and zc = Array . create ( n * n ) { re = 0 . ; im = 0 . } and blocsA = Array . init block_size ( fun x -> Array . init block_size ( fun _ -> Vector . create ( Vector . Custom customComplex ) ( n / block_size * n / block_size ) ) ) and blocsB = Array . init block_size ( fun x -> Array . init block_size ( fun _ -> Vector . create ( Vector . Custom customComplex ) ( n / block_size * n / block_size ) ) ) and blocsC = Array . init block_size ( fun x -> Array . init block_size ( fun _ -> Vector . create ( Vector . Custom customComplex ) ( n / block_size * n / block_size ) ) ) in for i = 0 to n * n - 1 do let a = { re = ( Random . float 3 . ) . * 5 . ; im = ( Random . float 3 . ) . * 5 . } and b = { re = ( Random . float 3 . ) . * 5 . ; im = ( Random . float 3 . ) . * 5 . } in Mem . set x i a ; Mem . set y i b ; xc . ( i ) <- a ; yc . ( i ) <- b ; done ; for i = 0 to block_size - 1 do for j = 0 to block_size - 1 do for n = 0 to n / block_size * n / block_size - 1 do let a = { re = ( Random . float 3 . ) . * 5 . ; im = ( Random . float 3 . ) . * 5 . } and b = { re = ( Random . float 3 . ) . * 5 . ; im = ( Random . float 3 . ) . * 5 . } in Mem . set blocsA . ( i ) . ( j ) n a ; Mem . set blocsB . ( i ) . ( j ) n b ; done ; done ; done ; let threadsPerBlock dev = match dev . Devices . specific_info with | Devices . OpenCLInfo clI -> ( match clI . Devices . device_type with | Devices . CL_DEVICE_TYPE_CPU -> 1 | _ -> 16 ) | _ -> 16 in let blocksPerGrid dev = ( n + ( threadsPerBlock dev ) - 1 ) / ( threadsPerBlock dev ) in let block dev = { Spoc . Kernel . blockX = threadsPerBlock dev ; Spoc . Kernel . blockY = threadsPerBlock dev ; Spoc . Kernel . blockZ = 1 ; } in let grid dev = { Spoc . Kernel . gridX = blocksPerGrid dev ; Spoc . Kernel . gridY = blocksPerGrid dev ; Spoc . Kernel . gridZ = 1 ; } in Kirc . gen matmult_complex ; let name = dev . Spoc . Devices . general_info . Spoc . Devices . name in measure_time ( fun ( ) -> Kirc . run matmult_complex ( x , y , z , n ) ( block dev , grid dev ) 0 dev ; Mem . to_cpu z ( ) ; Devices . flush dev ( ) ; ) ( " GPU " ^ name ) ; let blocksPerGrid dev = ( n / block_size + ( threadsPerBlock dev ) - 1 ) / ( threadsPerBlock dev ) in let block dev = { Spoc . Kernel . blockX = threadsPerBlock dev ; Spoc . Kernel . blockY = threadsPerBlock dev ; Spoc . Kernel . blockZ = 1 ; } in let grid dev = { Spoc . Kernel . gridX = blocksPerGrid dev ; Spoc . Kernel . gridY = blocksPerGrid dev ; Spoc . Kernel . gridZ = 1 ; } in let tasks = ref [ ] in let taskM = Mutex . create ( ) in let multicompute ( ) = for i = 0 to block_size - 1 do for j = 0 to block_size - 1 do tasks := ( fun ( block , grid ) -> for k = 0 to block_size - 1 do Kirc . run matmult_complex ( Mem . sub_vector blocsA . ( i ) . ( k ) 0 ( n * n / block_size / block_size ) , Mem . sub_vector blocsB . ( k ) . ( j ) 0 ( n * n / block_size / block_size ) , blocsC . ( i ) . ( j ) , ( n / block_size ) ) ( block , grid ) 0 dev ; done ; ) :: ! tasks done ; done ; in let rec worker i dev = Mutex . lock taskM ; match ! tasks with | t :: q -> tasks := q ; Mutex . unlock taskM ; t ( block dev , grid dev ) ; Devices . flush dev ( ) ; worker ( i + 1 ) dev | [ ] -> Mutex . unlock taskM in multicompute ( ) ; measure_time ( fun ( ) -> let t1 = Thread . create ( fun ( ) -> worker 0 devs . ( 0 ) ) ( ) in Thread . join t1 ; ) " 1 x 680 " ; for i = 0 to block_size - 1 do for j = 0 to block_size - 1 do for n = 0 to n / block_size * n / block_size - 1 do let a = { re = ( Random . float 3 . ) . * 5 . ; im = ( Random . float 3 . ) . * 5 . } and b = { re = ( Random . float 3 . ) . * 5 . ; im = ( Random . float 3 . ) . * 5 . } in Mem . set blocsA . ( i ) . ( j ) n a ; Mem . set blocsB . ( i ) . ( j ) n b ; done ; done ; done ; multicompute ( ) ; measure_time ( fun ( ) -> let t1 = Thread . create ( fun ( ) -> worker 0 devs . ( 0 ) ) ( ) and t2 = Thread . create ( fun ( ) -> worker 0 devs . ( 1 ) ) ( ) in Thread . join t1 ; Thread . join t2 ; ) " 2x 680 " ; for i = 0 to block_size - 1 do for j = 0 to block_size - 1 do for n = 0 to n / block_size * n / block_size - 1 do let a = { re = ( Random . float 3 . ) . * 5 . ; im = ( Random . float 3 . ) . * 5 . } and b = { re = ( Random . float 3 . ) . * 5 . ; im = ( Random . float 3 . ) . * 5 . } in Mem . set blocsA . ( i ) . ( j ) n a ; Mem . set blocsB . ( i ) . ( j ) n b ; done ; done ; done ; multicompute ( ) ; measure_time ( fun ( ) -> let t1 = Thread . create ( fun ( ) -> worker 0 devs . ( 0 ) ) ( ) and t2 = Thread . create ( fun ( ) -> worker 0 devs . ( 1 ) ) ( ) and t3 = Thread . create ( fun ( ) -> worker 0 devs . ( 2 ) ) ( ) in Thread . join t1 ; Thread . join t2 ; Thread . join t3 ; ) " 2x 680 + i7 " ; measure_time ( cpu_compute xc yc zc ) " CPU " |
let input_bigstring ic buf off len = let tmp = Bytes . create len in let res = input ic tmp 0 len in Bigstringaf . blit_from_bytes tmp ~ src_off : 0 buf ~ dst_off : off ~ len : res ; res |
let output_bigstring oc buf off len = let res = Bigstringaf . substring buf ~ off ~ len in output_string oc res |
module N : sig type encoder type dst = [ ` Channel of out_channel | ` Buffer of Buffer . t | ` Manual ] type ret = [ ` Flush of encoder | ` End ] val dst_rem : encoder -> int val dst : encoder -> Zl . bigstring -> int -> int -> encoder val encode : encoder -> ret val encoder : i : Zl . bigstring -> q : De . Queue . t -> w : De . Lz77 . window -> source : int -> H . bigstring -> dst -> Duff . hunk list -> encoder type dst = [ ` Channel of out_channel | ` Buffer of Buffer . t | ` Manual ] type encoder = { dst : dst ; src : Bigstringaf . t ; o : H . bigstring ; o_pos : int ; o_max : int ; h : H . N . encoder ; z : Zl . Def . encoder ; t : Zl . bigstring ; d : [ ` Copy of int * int | ` Insert of string | ` End | ` Await ] list ; } type ret = [ ` Flush of encoder | ` End ] let flush k e = match e . dst with | ` Manual -> ` Flush e | ` Channel oc -> output_bigstring oc e . o 0 e . o_pos ; k { e with o_pos = 0 } | ` Buffer b -> for i = 0 to e . o_pos - 1 do Buffer . add_char b ( Bigstringaf . get e . o i ) done ; k { e with o_pos = 0 } let rec encode_z e = match Zl . Def . encode e . z with | ` End z -> let len = Bigstringaf . length e . o - Zl . Def . dst_rem z in let z = Zl . Def . dst z De . bigstring_empty 0 0 in if len > 0 then flush encode_z { e with z ; o_pos = len } else ` End | ` Flush z -> let len = Bigstringaf . length e . o - Zl . Def . dst_rem z in flush encode_z { e with z ; o_pos = len } | ` Await z -> ( match e . d with | [ ] -> let z = Zl . Def . src z De . bigstring_empty 0 0 in encode_z { e with z } | d -> H . N . dst e . h e . t 0 ( De . bigstring_length e . t ) ; encode_h e d ) and encode_h e d = let v , d = match d with v :: d -> v , d | [ ] -> ` End , [ ] in match H . N . encode e . h v , d with | ` Ok , [ ] -> let len = Bigstringaf . length e . t - H . N . dst_rem e . h in let z = Zl . Def . src e . z e . t 0 len in encode_z { e with d ; z } | ` Ok , d -> encode_h { e with d } d | ` Partial , d -> let len = Bigstringaf . length e . t - H . N . dst_rem e . h in let z = Zl . Def . src e . z e . t 0 len in encode_z { e with d = ` Await :: d ; z } let encode e = encode_z e let encoder ~ i ~ q ~ w ~ source src dst hunks = let o , o_pos , o_max = match dst with | ` Manual -> De . bigstring_empty , 1 , 0 | ` Buffer _ | ` Channel _ -> De . bigstring_create H . io_buffer_size , 0 , H . io_buffer_size - 1 in let z = Zl . Def . encoder ` Manual ` Manual ~ q ~ w ~ level : 0 in let z = Zl . Def . dst z De . bigstring_empty 0 0 in { dst ; src ; o ; o_pos ; o_max ; t = i ; d = List . map ( function | Duff . Copy ( off , len ) -> ` Copy ( off , len ) | Duff . Insert ( off , len ) -> ` Insert ( Bigstringaf . substring src ~ off ~ len ) ) hunks ; z ; h = H . N . encoder ` Manual ~ dst_len ( : Bigstringaf . length src ) ~ src_len : source ; } let dst_rem e = e . o_max - e . o_pos + 1 let dst e s j l = let z = Zl . Def . dst e . z s j l in { e with z ; o = s ; o_pos = j ; o_max = j + l - 1 } end |
module M : sig type decoder type src = [ ` Channel of in_channel | ` String of string | ` Manual ] type decode = [ ` Await of decoder | ` Header of int * int * decoder | ` End of decoder | ` Malformed of string ] val src_len : decoder -> int val dst_len : decoder -> int val src_rem : decoder -> int val dst_rem : decoder -> int val src : decoder -> Zl . bigstring -> int -> int -> decoder val dst : decoder -> H . bigstring -> int -> int -> decoder val source : decoder -> H . bigstring -> decoder val decode : decoder -> decode val decoder : ? source : H . bigstring -> o : Zl . bigstring -> allocate ( : int -> Zl . window ) -> src -> decoder type src = [ ` Channel of in_channel | ` String of string | ` Manual ] type decoder = { src : src ; dst : H . bigstring ; dst_len : int ; src_len : int ; i : Zl . bigstring ; i_pos : int ; i_len : int ; o : Zl . bigstring ; z : Zl . Inf . decoder ; h : H . M . decoder ; k : decoder -> decode ; } and decode = [ ` Await of decoder | ` Header of int * int * decoder | ` End of decoder | ` Malformed of string ] let refill k d = match d . src with | ` String _ -> let z = Zl . Inf . src d . z De . bigstring_empty 0 0 in k { d with z } | ` Channel ic -> let res = input_bigstring ic d . i 0 ( De . bigstring_length d . i ) in let z = Zl . Inf . src d . z d . i 0 res in k { d with z } | ` Manual -> ` Await { d with k } let rec decode d = match H . M . decode d . h with | ` Header ( src_len , dst_len ) -> ` Header ( src_len , dst_len , { d with src_len ; dst_len ; k = decode } ) | ` End -> ` End { d with k = decode } | ` Malformed err -> ` Malformed err | ` Await -> inflate { d with z = Zl . Inf . flush d . z } and inflate d = match Zl . Inf . decode d . z with | ` Await z -> let dst_len = De . bigstring_length d . o - Zl . Inf . dst_rem z in H . M . src d . h d . o 0 dst_len ; refill inflate { d with z } | ` End z -> let dst_len = De . bigstring_length d . o - Zl . Inf . dst_rem z in H . M . src d . h d . o 0 dst_len ; decode { d with z } | ` Flush z -> let dst_len = De . bigstring_length d . o - Zl . Inf . dst_rem z in H . M . src d . h d . o 0 dst_len ; decode { d with z } | ` Malformed err -> ` Malformed err let src d s j l = let z = Zl . Inf . src d . z s j l in { d with z } let dst d s j l = H . M . dst d . h s j l ; d let source d src = H . M . source d . h src ; d let dst_len d = let dst_len = H . M . dst_len d . h in assert ( d . dst_len = dst_len ) ; dst_len let src_len d = let src_len = H . M . src_len d . h in assert ( d . src_len = src_len ) ; src_len let dst_rem d = H . M . dst_rem d . h let src_rem d = Zl . Inf . src_rem d . z let decoder ? source ~ o ~ allocate src = let decoder_z = Zl . Inf . decoder ` Manual ~ o ~ allocate in let decoder_h = H . M . decoder ` Manual ? source in let i , i_pos , i_len = match src with | ` Manual -> De . bigstring_empty , 1 , 0 | ` String x -> ( Bigstringaf . of_string x ~ off : 0 ~ len ( : String . length x ) , 0 , String . length x - 1 ) | ` Channel _ -> Bigstringaf . create De . io_buffer_size , 1 , 0 in { src ; dst = De . bigstring_empty ; dst_len = 0 ; src_len = 0 ; i ; i_pos ; i_len ; o ; z = decoder_z ; h = decoder_h ; k = decode ; } let decode d = d . k d end |
type chIP_sample = [ | ` ChIP_Pho4_noPi | ` ChIP_Pho4_highPi | ` ChIP_Cbf1_noPi | ` ChIP_Mock_noPi ] |
type input_sample = [ | ` Input_Pho4_noPi | ` Input_Pho4_highPi | ` Input_Cbf1_noPi | ` Input_Mock_noPi ] |
type sample = [ | chIP_sample | input_sample ] |
type factor = [ | ` Pho4 | ` Cbf1 | ` Mock ] |
type condition = [ | ` noPi | ` highPi ] |
let factor = function | ` ChIP_Pho4_highPi | ` ChIP_Pho4_noPi -> ` Pho4 | ` ChIP_Cbf1_highPi | ` ChIP_Cbf1_noPi -> ` Cbf1 | ` ChIP_Mock_highPi | ` ChIP_Mock_noPi -> ` Mock |
let condition = function | ` ChIP_Mock_highPi | ` ChIP_Pho4_highPi | ` ChIP_Cbf1_highPi -> ` highPi | ` ChIP_Pho4_noPi | ` ChIP_Cbf1_noPi | ` ChIP_Mock_noPi -> ` noPi |
let control_sample = function | ` ChIP_Cbf1_noPi -> ` Input_Cbf1_noPi | ` ChIP_Pho4_noPi -> ` Input_Pho4_noPi | ` ChIP_Pho4_highPi -> ` Input_Pho4_highPi | ` ChIP_Mock_noPi -> ` Input_Mock_noPi |
let genome = Ucsc_gb . genome_sequence ` sacCer2 |
let genome_2bit = Ucsc_gb . genome_2bit_sequence ` sacCer2 |
let srr_id = function | ` ChIP_Pho4_noPi -> [ " SRR217304 " ; " SRR217305 " ] | ` ChIP_Pho4_highPi -> [ " SRR217306 " ] | ` ChIP_Cbf1_noPi -> [ " SRR217310 " ] | ` ChIP_Mock_noPi -> [ " SRR217312 " ] | ` Input_WT_noPi -> [ " SRR217324 " ] | ` Input_Pho4_noPi -> [ " SRR217319 " ] | ` Input_Pho4_highPi -> [ " SRR217320 " ] | ` Input_Cbf1_noPi -> [ " SRR217323 " ] | ` Input_Mock_noPi -> [ " SRR217324 " ] |
let fastq x = srr_id x |> List1 . of_list_exn |> List1 . map ~ f ( : fun id -> Sra_toolkit . ( fastq_dump fastq_gz ) ( ` id id ) |> Fastq_sample . compressed_se ) |
let ecoli_genome : fasta file = Bistro_unix . wget " ftp :// ftp . ncbi . nlm . nih . gov / genomes / all / GCF / 000 / 005 / 845 / GCF_000005845 . 2_ASM584v2 / GCF_000005845 . 2_ASM584v2_genomic . fna . gz " |> Bistro_unix . gunzip |
let fastq_screen x = Fastq_screen . fastq_screen ( List1 . hd ( fastq x ) ) [ " E_coli " , ecoli_genome ] |
let bowtie_index = Bowtie . bowtie_build genome |
let mapped_reads x = let Cons ( fq , additional_samples ) = fastq x in Bowtie . bowtie ~ v : 1 bowtie_index ~ additional_samples fq |
let mapped_reads_bam x = Samtools . indexed_bam_of_sam ( mapped_reads x ) |
let tf_peaks ? qvalue treatment_sample = let control_sample = control_sample treatment_sample in let treatment = mapped_reads treatment_sample in let control = mapped_reads control_sample in Macs2 . callpeak ~ mfold ( : 1 , 100 ) ? qvalue Macs2 . sam ~ control [ : control ] [ treatment ] |
let centered_tf_peaks ? qvalue ~ radius treatment_sample = let summits = Macs2 . peak_summits ( tf_peaks ? qvalue treatment_sample ) in let chrom_sizes = Ucsc_gb . fetchChromSizes ` sacCer2 in Bedtools . ( slop ~ mode ( ` : both radius ) bed summits chrom_sizes ) |
let best_macs_summits ? qvalue ~ n sample = let summits = Macs2 . peak_summits ( tf_peaks ? qvalue sample ) in let open Bistro . Shell_dsl in Bistro . Workflow . shell ~ descr " : best_macs_summits " [ pipe [ cmd " sort " [ string " - r - g - k 5 " ; dep summits ; ] ; cmd " head " ~ stdout : dest [ opt " - n " int n ; ] ] ] |
let best_peak_sequences ( ? nseqs = Int . max_value ) ? qvalue ~ radius treatment_sample = let summits = best_macs_summits ? qvalue ~ n : nseqs treatment_sample in let chrom_sizes = Ucsc_gb . fetchChromSizes ` sacCer2 in let regions = Bedtools . ( slop ~ mode ( ` : both radius ) bed summits chrom_sizes ) in Ucsc_gb . twoBitToFa genome_2bit ( Bed . keep4 regions ) |
let meme ( ? nseqs = 500 ) treatment_sample = best_peak_sequences ~ nseqs ~ qvalue : 1e - 10 ~ radius : 50 treatment_sample |> Meme_suite . meme ~ nmotifs : 3 ~ minw : 5 ~ maxw : 8 ~ revcomp : true ~ alphabet ` : dna ~ maxsize : 1_000_000 |
let meme_motifs treatment_sample = Bistro . Workflow . select ( meme treatment_sample ) [ " meme . txt " ] |
let meme_chip treatment_sample = best_peak_sequences ~ qvalue : 1e - 10 ~ radius : 50 treatment_sample |> Meme_suite . meme_chip ~ meme_nmotifs : 3 ~ meme_minw : 5 ~ meme_maxw : 8 |
let chipqc = let samples = List . map all_of_chIP_sample ~ f ( : fun x -> { ChIPQC . id = show_chIP_sample x ; tissue = " yeast " ; factor = show_factor ( factor x ) ; replicate = " 1 " ; bam = mapped_reads_bam x ; peaks = Macs2 . narrow_peaks ( tf_peaks x ) ; } ) in ChIPQC . run samples |
let occdist_vs_peak_score treatment_sample : svg file = let open Bistro . Shell_dsl in let peaks = centered_tf_peaks ~ radius : 500 treatment_sample in let sequences = Ucsc_gb . twoBitToFa genome_2bit ( Bed . keep4 peaks ) in let occ = dep @@ Meme_suite . fimo ( meme_motifs treatment_sample ) sequences in let peaks = dep peaks in let script = [ % script { | closest_occ <- sapply ( peaks $ id , function ( p ) { o <- occ [ occ $ X . pattern . name == m & occ $ sequence . name == as . character ( p ) , ] pos <- c ( 1000 , ( o $ start + o $ start + 1 ) / 2 ) pos [ which . min ( abs ( pos - 500 ) ) ] } ) plot ( peaks $ score , closest_occ , main = sprintf ( " motif % d " , m ) , xlab " = Peak score " , ylab " = Closest occ " ) close_occ <- abs ( closest_occ - 500 ) < 100 print ( summary ( close_occ ) ) df <- data . frame ( score = peaks $ score , close_occ = close_occ ) g <- glm ( close_occ ~ score , df , family " = binomial " ) plot ( peaks $ score , close_occ , xlab " = Peak score " , ylab " = Close occ prob " ) lines ( peaks $ score , predict ( g , type " = resp " ) ) } dev . off ( ) } ] | in Bistro . Workflow . shell ~ descr " : occdist_vs_peak_rank " [ cmd " Rscript " [ file_dump script ] ] |
let report = [ % include_script " lib / bio / examples / zhou2011 . md " ] |> Report . Md . to_html |
let repo = Repo . [ item [ " report . html " ] report ; ] |
let run ( ) = Repo . build_main ~ np ~ mem ( ` : GB 4 ) ~ outdir " : res " ~ loggers [ : Console_logger . create ( ) ] repo |
module Dataset = struct type t = [ ` SongD1 ] let to_string = function | ` SongD1 -> " SongD1 " let alignments d = Bistro_unix . wget " https :// ndownloader . figshare . com / files / 9473962 " |> Bistro_unix . tar_xfj |> Fn . flip Workflow . select [ " single - gene_alignments " ; to_string d ] |> Workflow . glob ~ pattern " " :* let best_trees d = Bistro_unix . wget " https :// ndownloader . figshare . com / files / 9473953 " |> Bistro_unix . tar_xfj |> Fn . flip Workflow . select [ " single - gene_trees " ; to_string d ; " Best_observed " ] |> Workflow . glob ~ pattern " " :* end |
module Raxml = struct let img = [ docker_image ~ account " : pveber " ~ name " : raxml " ~ tag " : 8 . 2 . 9 " ( ) ] let hpc alignment = Workflow . shell ~ descr " : raxmlhpc " ~ np : 4 [ within_container img ( and_list [ cd tmp ; cmd " raxmlHPC " [ opt " - T " ident np ; string " - p 1 - m GTRGAMMA -- no - bfgs " ; opt " - s " dep alignment ; string " - n NAME " ; ] ; ] ) ; mv ( tmp // " RAxML_bestTree . NAME " ) dest ; ] end |
module Fasttree = struct let img = [ docker_image ~ account " : pveber " ~ name " : fasttree " ~ tag " : 2 . 1 . 10 " ( ) ] let fasttree fa = Workflow . shell ~ descr " : fasttree " [ cmd ~ img " / usr / local / bin / FastTree " ~ stdout : dest [ string " - nt - gtr - gamma - spr 4 - mlacc 2 - slownni " ; dep fa ; ] ] end |
module IQTree = struct let img = [ docker_image ~ account " : pveber " ~ name " : iqtree " ~ tag " : 1 . 4 . 2 " ( ) ] let iqtree fa = let tmp_ali_fn = " data . fa " in let tmp_ali = tmp // tmp_ali_fn in Workflow . shell ~ descr " : iqtree " [ within_container img ( and_list [ cmd " ln " [ string " - s " ; dep fa ; tmp_ali ] ; cmd " / usr / local / bin / iqtree " [ string " - m GTR + G4 " ; opt " - s " ident tmp_ali ; string " - seed 1 " ; opt " - nt " ident np ; ] ; mv ( tmp // ( tmp_ali_fn ^ " . treefile " ) ) dest ; ] ) ] end |
module PhyML = struct let img = [ docker_image ~ account " : pveber " ~ name " : phyml " ~ tag " : 3 . 3 . 20180129 " ( ) ] let phyml alignment = let tmp_ali_fn = " alignment " in let tmp_ali = tmp // tmp_ali_fn in Workflow . shell ~ descr " : phyml " [ within_container img ( and_list [ cd tmp ; cmd " ln " [ string " - s " ; dep alignment ; tmp_ali ] ; cmd " / usr / local / bin / phyml " [ opt " - i " ident tmp_ali ; string " -- r_seed 1 - d nt - b 0 - m GTR - f e - c 4 - a e - s SPR -- n_rand_starts 1 - o tlr - p -- run_id ID " ; ] ; mv ( tmp // ( tmp_ali_fn ^ " * _phyml_tree_ID . txt " ) ) dest ; ] ) ] end |
module Goalign = struct let img = [ docker_image ~ account " : pveber " ~ name " : goalign " ~ tag " : 0 . 2 . 9 " ( ) ] let phylip_of_fasta fa = Workflow . shell ~ descr " : goalign . reformat " [ cmd " goalign " ~ img [ string " reformat phylip " ; opt " - i " dep fa ; opt " - o " ident dest ; ] ] end |
module Gotree = struct let img = [ docker_image ~ account " : pveber " ~ name " : gotree " ~ tag " : 0 . 2 . 10 " ( ) ] let compare_trees ~ input ~ reference = Workflow . shell ~ descr " : gotree . compare " [ cmd " / usr / local / bin / gotree " ~ stdout : dest ~ img [ string " compare trees -- binary " ; opt " - i " dep input ; opt " - c " dep reference ; ] ] end |
let tree_inference meth fa = match meth with | ` Fasttree -> Fasttree . fasttree fa | ` RAXML -> Raxml . hpc fa | ` IQTree -> IQTree . iqtree fa | ` PhyML -> PhyML . phyml ( Goalign . phylip_of_fasta fa ) |
let inferred_trees d meth = Workflow . spawn ( Dataset . alignments d ) ~ f ( : tree_inference meth ) |
let comparisons d meth = Workflow . spawn2 ( inferred_trees d meth ) ( Dataset . best_trees d ) ~ f ( : fun input reference -> Gotree . compare_trees ~ input ~ reference ) List . map [ % eval Workflow . ( spawn results ~ f : eval_path ) ] ~ f ( : fun fn -> In_channel . read_lines fn |> Fn . flip List . nth_exn 1 ) |> Out_channel . write_lines [ % dest ] |
let repo = Repo . [ item [ " concatenated_comps_fasttree " ] ( concat ( comparisons ` SongD1 ` Fasttree ) ) ; items [ " comps_fasttree " ] ~ prefix " : tree " ( comparisons ` SongD1 ` Fasttree ) ; ] |
let ( ) = Repo . build_main ~ loggers [ : Console_logger . create ( ) ] ~ np : 4 ~ mem ( ` : GB 4 ) ~ outdir " : res " repo |
type t = { num : int ; source : string ; } { arrnm : string ; index : t ; } |
let compare id1 id2 = compare id1 . num id2 . num |
let name id = id . source ^ " _ " ^ ( string_of_int id . num ) |
let source id = id . source |
let num = ref 0 |
let fresh s = num := ! num + 1 ; { num = ! num ; source = s } |
let fprint_t ff id = Format . fprintf ff " % s " ( name id ) |
module M = struct type t = t_alias let compare = compare let fprint = fprint_t end |
module Env = struct include ( Map . Make ( M ) ) let singleton i tentry = add i tentry empty let fprint_t fprint_v ff s = Format . fprintf ff " [ @< hov { >@ " ; iter ( fun k v -> Format . fprintf ff " [ @% a : % a ] " @ M . fprint k fprint_v v ) s ; Format . fprintf ff " } ] " @ let fprint_3ident ff s = let fprint_v ff ( id1 , id2 , id3 ) = Format . fprintf ff " [ @% a ] " @ ( Pp_tools . print_list_r M . fprint " ( " " , " " ) " ) [ id1 ; id2 ; id3 ] in fprint_t fprint_v ff s let append env0 env = fold ( fun x v acc -> update x ( function _ -> Some ( v ) ) acc ) env0 env end |
module S = struct include ( Set . Make ( M ) ) let fprint_t ff s = Format . fprintf ff " [ @< hov { >@ " ; iter ( fun e -> Format . fprintf ff " % a @ " M . fprint e ) s ; Format . fprintf ff " } ] " @ let fresh s ss = let add_fresh id m = Env . add id ( fresh s ) m in fold add_fresh ss Env . empty let domain acc env = Env . fold ( fun k _ set -> add k set ) env acc let range acc env = Env . fold ( fun _ v set -> add v set ) env acc let map f s = fold ( fun e rs -> add ( f e ) rs ) s empty end |
let bpw = dbits / 8 |
let asft = Int . ceil_log2 bpw |
let reg_spec = Reg_spec . create ( ) ~ clock ~ clear |
module Memory = struct module I = struct type ' a t = { memory_data_in : ' a [ @ bits dbits ] ; memory_ready : ' a } [ @@ deriving sexp_of , hardcaml ] end module O = struct type ' a t = { memory_request : ' a ; memory_read_write : ' a ; memory_address : ' a [ @ bits dbits ] ; memory_data_out : ' a [ @ bits dbits ] } [ @@ deriving sexp_of , hardcaml ] end end |
let memory_if ~ e ~ stack_o ~ bc_o ~ mem_o ~ ext_i = let open Memory . I in let open Memory . O in let open Always in let ( -- ) s n = s -- ( " memory_if_ " ^ n ) in let module States = struct type t = | Request | Ready [ @@ deriving enumerate , compare , sexp_of ] end in let { State_machine . is ; switch = sm ; set_next = next ; _ } = State_machine . create ( module States ) ~ enable : e reg_spec in let m = [ stack_o ; bc_o ; mem_o ] in let req = concat_lsb ( List . map m ~ f ( : fun ( x : Always . Variable . t Memory . O . t ) -> x . memory_request . value ) ) in let gnt = let e = e &: is Request -- " arbiter_en " in let prefix f l = List . fold l ~ init [ ] : ~ f ( : fun acc x -> match acc with | [ ] -> [ x ] | h :: t -> f x h :: h :: t ) |> List . rev in Arbiter . arbiter ~ prefix ~ enable : e ~ req in let gntb = onehot_to_binary gnt in let sel f = mux gntb ( List . map m ~ f ) in let ext_o = { memory_data_out = sel ( fun x -> x . memory_data_out . value ) ; memory_read_write = sel ( fun x -> x . memory_read_write . value ) ; memory_address = sel ( fun x -> x . memory_address . value ) ; memory_request = sel ( fun x -> x . memory_request . value ) } in Always . ( compile [ sm [ Request , [ when_ ( req . <>: 0 ) [ next Ready ] ] ; Ready , [ when_ ext_i . memory_ready [ next Request ] ] ] ] ) ; let stack_i , bc_i , mem_i = let mk i = { memory_data_in = ext_i . memory_data_in ; memory_ready = bit gnt i &: ext_i . memory_ready } in mk 0 , mk 1 , mk 2 in ext_o , stack_i , bc_i , mem_i ; ; |
module Decode = struct type ' a t = { acc : ' a ; acc_op : ' a ; push : ' a ; pushacc : ' a ; push_op : ' a ; pop : ' a ; assign : ' a ; envacc : ' a ; envacc_op : ' a ; pushenvacc : ' a ; pushenvacc_op : ' a ; push_retaddr : ' a ; apply : ' a ; apply_op : ' a ; appterm : ' a ; appterm_op : ' a ; closure : ' a ; closurerec : ' a ; return : ' a ; restart : ' a ; grab : ' a ; offsetclosure : ' a ; offsetclosure_op : ' a ; pushoffsetclosure : ' a ; pushoffsetclosure_op : ' a ; pushgetglobal : ' a ; getglobal : ' a ; pushgetglobalfield : ' a ; getglobalfield : ' a ; setglobal : ' a ; atom : ' a ; atom_op : ' a ; pushatom : ' a ; pushatom_op : ' a ; makeblock : ' a ; makeblock_op : ' a ; getfield : ' a ; getfield_op : ' a ; setfield : ' a ; setfield_op : ' a ; vectlength : ' a ; getvectitem : ' a ; setvectitem : ' a ; getstringchar : ' a ; setstringchar : ' a ; branch : ' a ; branch_op : ' a ; boolnot : ' a ; pushtrap : ' a ; poptrap : ' a ; raise_ : ' a ; check_signals : ' a ; c_call : ' a ; c_call_op : ' a ; const : ' a ; const_op : ' a ; pushconst : ' a ; pushconst_op : ' a ; alu : ' a ; alu_op : ' a ; comp : ' a ; comp_op : ' a ; offsetint : ' a ; offsetref : ' a ; isint : ' a ; getmethod : ' a ; bcomp : ' a ; bcomp_op : ' a ; ucomp : ' a ; ucomp_op : ' a ; bucomp : ' a ; bucomp_op : ' a ; getpubmet : ' a ; getdynmet : ' a ; stop : ' a ; event : ' a ; break : ' a ; reraise : ' a ; raise_notrace : ' a } [ @@ deriving sexp_of , hardcaml ] end |
Subsets and Splits