text
stringlengths 12
786k
|
---|
let lookup_module name env = let path , md = Env . find_module_by_name name env in path , md . Types . md_type , md . Types . md_attributes |
let verbosity = ref 0 |
module Printtyp = struct include Printtyp let expand_type env ty = Env . with_cmis @@ fun ( ) -> if ! verbosity = 0 then ty else let ty = Subst . type_expr Subst . identity ty in let marks = Hashtbl . create 7 in let mark ty = if Hashtbl . mem marks ty . Types . id then false else ( Hashtbl . add marks ty . Types . id ( ) ; true ) in let rec iter d ty0 = let ty ' = Ctype . repr ty0 in if mark ty ' then let open Types in let ty ' ' = Ctype . full_expand env ty ' in if ty ' ' . desc == ty ' . desc then Btype . iter_type_expr ( iter d ) ty0 else begin let desc = match ty ' ' . desc with | Tvariant row -> Tvariant { row with row_name = None } | Tobject ( ty , _ ) -> Tobject ( ty , ref None ) | desc -> desc in ty0 . desc <- desc ; if d > 0 then Btype . iter_type_expr ( iter ( pred d ) ) ty0 end in iter ! verbosity ty ; ty let expand_type_decl env ty = match ty . Types . type_manifest with | Some m -> { ty with Types . type_manifest = Some ( expand_type env m ) } | None -> ty let expand_sig env mty = Env . with_cmis @@ fun ( ) -> Env . scrape_alias env mty let verbose_type_scheme env ppf t = Printtyp . type_scheme ppf ( expand_type env t ) let verbose_type_declaration env id ppf t = Printtyp . type_declaration id ppf ( expand_type_decl env t ) let verbose_modtype env ppf t = Printtyp . modtype ppf ( expand_sig env t ) let select_verbose a b env = ( if ! verbosity = 0 then a else b env ) let type_scheme env ppf ty = select_verbose type_scheme verbose_type_scheme env ppf ty let type_declaration env id ppf = select_verbose type_declaration verbose_type_declaration env id ppf let modtype env ppf mty = select_verbose modtype verbose_modtype env ppf mty let wrap_printing_env env ~ verbosity : v f = let_ref verbosity v ( fun ( ) -> wrap_printing_env env f ) end |
let rec mod_smallerthan n m = if n < 0 then None else let open Types in match m with | Mty_ident _ -> Some 1 | Mty_signature s -> begin match List . length_lessthan n s with | None -> None | Some _ -> List . fold_left s ~ init ( : Some 0 ) ~ f : begin fun acc item -> let sub n1 m = match mod_smallerthan ( n - n1 ) m with | Some n2 -> Some ( n1 + n2 ) | None -> None in match acc , Raw_compat . si_modtype_opt item with | None , _ -> None | Some n ' , _ when n ' > n -> None | Some n1 , Some mty -> sub n1 mty | Some n ' , _ -> Some ( succ n ' ) end end | Mty_functor _ -> let ( m1 , m2 ) = unpack_functor m in begin match mod_smallerthan n m2 , m1 with | None , _ -> None | result , Unit -> result | Some n1 , Named ( _ , mt ) -> match mod_smallerthan ( n - n1 ) mt with | None -> None | Some n2 -> Some ( n1 + n2 ) end | _ -> Some 1 |
let print_short_modtype verbosity env ppf md = match mod_smallerthan 1000 md with | None when verbosity = 0 -> Format . pp_print_string ppf " " ; | _ -> Printtyp . modtype env ppf md |
let print_type_with_decl ~ verbosity env ppf typ = if verbosity > 0 then match ( Ctype . repr typ ) . Types . desc with | Types . Tconstr ( path , params , _ ) -> let decl = Env . with_cmis @@ fun ( ) -> Env . find_type path env in let is_abstract = match decl . Types . type_kind with | Types . Type_abstract -> true | _ -> false in let print_expr = is_abstract || params <> [ ] in if print_expr then Printtyp . type_scheme env ppf typ ; if not is_abstract then begin if print_expr then begin Format . pp_print_newline ppf ( ) ; Format . pp_print_newline ppf ( ) ; end ; let ident = match path with | Path . Papply _ -> assert false | Path . Pdot _ -> Ident . create_persistent ( Path . last path ) | Path . Pident ident -> ident in Printtyp . type_declaration env ident ppf decl end | _ -> Printtyp . type_scheme env ppf typ else Printtyp . type_scheme env ppf typ |
let print_exn ppf exn = match Location . error_of_exn exn with | None | Some ` Already_displayed -> Format . pp_print_string ppf ( Printexc . to_string exn ) | Some ( ` Ok report ) -> Location . print_main ppf report |
let print_type ppf env lid = let p , t = Env . find_type_by_name lid . Asttypes . txt env in Printtyp . type_declaration env ( Ident . create_persistent ( Path . last p ) ) ppf t |
let print_modtype ppf verbosity env lid = let _p , mtd = Env . find_modtype_by_name lid . Asttypes . txt env in match mtd . mtd_type with | Some mt -> print_short_modtype verbosity env ppf mt | None -> Format . pp_print_string ppf " " |
let print_modpath ppf verbosity env lid = let _path , md = Env . find_module_by_name lid . Asttypes . txt env in print_short_modtype verbosity env ppf ( md . md_type ) |
let print_constr ppf env lid = let cstr_desc = Env . find_constructor_by_name lid . Asttypes . txt env in ! Oprint . out_type ppf ( Browse_misc . print_constructor cstr_desc ) |
let type_in_env ( ? verbosity = 0 ) ? keywords ~ context env ppf expr = let print_expr expression = let ( str , _sg , _ ) = Env . with_cmis @@ fun ( ) -> Typemod . type_toplevel_phrase env [ Ast_helper . Str . eval expression ] in let open Typedtree in let exp = Raw_compat . dest_tstr_eval str in print_type_with_decl ~ verbosity env ppf exp . exp_type in Printtyp . wrap_printing_env env ~ verbosity @@ fun ( ) -> Msupport . uncatch_errors @@ fun ( ) -> match parse_expr ? keywords expr with | exception exn -> print_exn ppf exn ; false | e -> let extract_specific_parsing_info e = match e . Parsetree . pexp_desc with | Parsetree . Pexp_ident longident -> ` Ident longident | Parsetree . Pexp_construct ( longident , _ ) -> ` Constr longident | _ -> ` Other in let open Context in match extract_specific_parsing_info e with | ` Ident longident | ` Constr longident -> begin try begin match context with | Label lbl_des -> Printtyp . type_expr ppf lbl_des . lbl_arg ; | Type -> print_type ppf env longident | Module_type -> print_modtype ppf verbosity env longident | Module_path -> print_modpath ppf verbosity env longident | Constructor _ -> print_constr ppf env longident | _ -> raise Fallback end ; true with _ -> try print_expr e ; true with exn -> try print_modpath ppf verbosity env longident ; true with _ -> try print_modtype ppf verbosity env longident ; true with _ -> try print_constr ppf env longident ; true with _ -> print_exn ppf exn ; false end | ` Other -> try print_expr e ; true with exn -> print_exn ppf exn ; false |
let read_doc_attributes attrs = let rec loop = function | ( { Location . txt = ( " doc " | " ocaml . doc " ) ; loc = _ } , payload ) :: _ -> Ast_helper . extract_str_payload payload | _ :: rest -> loop rest | [ ] -> None in loop ( List . map ~ f : Ast_helper . Attr . as_tuple attrs ) |
let is_deprecated = List . exists ~ f ( : fun ( attr : Parsetree . attribute ) -> match Ast_helper . Attr . as_tuple attr with | { Location . txt = ( " deprecated " | " ocaml . deprecated " ) ; loc = _ } , _ -> true | _ -> false ) |
module List = struct let map t ~ f = List . rev ( List . rev_map f t ) end |
module Make ( Pos : sig type t val sexp_of_t : t -> Type . t end ) = struct module T = struct type t = | Atom of Pos . t * string * string option | List of Pos . t * t_or_comment list * Pos . t and t_or_comment = | Sexp of t | Comment of comment and comment = | Plain_comment of Pos . t * string | Sexp_comment of Pos . t * comment list * t end include T module type S = sig include module type of T val sexp_of_t : t -> Type . t val sexp_of_comment : comment -> Type . t val sexp_of_t_or_comment : t_or_comment -> Type . t end module To_sexp : sig val of_t : t -> Type . t val of_comment : comment -> Type . t val of_t_or_comment : t_or_comment -> Type . t end = struct let of_pos = Pos . sexp_of_t let of_string x = Type . Atom x let of_list of_a xs = Type . List ( List . map ~ f : of_a xs ) let of_option of_a = function | Some x -> Type . List [ of_a x ] | None -> Type . List [ ] ; ; let rec of_t = function | Atom ( v1 , v2 , v3 ) -> Type . List [ Type . Atom " Atom " ; of_pos v1 ; of_string v2 ; of_option of_string v3 ] | List ( v1 , v2 , v3 ) -> Type . List [ Type . Atom " List " ; of_pos v1 ; of_list of_t_or_comment v2 ; of_pos v3 ] and of_t_or_comment = function | Sexp t -> Type . List [ Type . Atom " Sexp " ; of_t t ] | Comment c -> Type . List [ Type . Atom " Comment " ; of_comment c ] and of_comment = function | Plain_comment ( v1 , v2 ) -> Type . List [ Type . Atom " Plain_comment " ; of_pos v1 ; of_string v2 ] | Sexp_comment ( v1 , v2 , v3 ) -> Type . List [ Type . Atom " Sexp_comment " ; of_pos v1 ; of_list of_comment v2 ; of_t v3 ] ; ; end let sexp_of_t = To_sexp . of_t let sexp_of_comment = To_sexp . of_comment let sexp_of_t_or_comment = To_sexp . of_t_or_comment end |
module Parsed = Make ( Src_pos . Absolute ) |
let relativize = let rel ~ outer_p p = Src_pos . Absolute . diff p outer_p in let rec aux_t ~ outer_p = function | Parsed . Atom ( pos , s , sopt ) -> Atom ( rel pos ~ outer_p , s , sopt ) | Parsed . List ( start_pos , tocs , end_pos ) -> List ( rel start_pos ~ outer_p , List . map tocs ~ f ( : fun toc -> aux_toc ~ outer_p : start_pos toc ) , rel end_pos ~ outer_p ) and aux_toc ~ outer_p = function | Parsed . Sexp t -> Sexp ( aux_t t ~ outer_p ) | Parsed . Comment c -> Comment ( aux_c c ~ outer_p ) and aux_c ~ outer_p = function | Parsed . Plain_comment ( pos , txt ) -> Plain_comment ( rel pos ~ outer_p , txt ) | Parsed . Sexp_comment ( pos , cs , t ) -> Sexp_comment ( rel pos ~ outer_p , List . map cs ~ f ( : fun c -> aux_c ~ outer_p c ) , aux_t t ~ outer_p ) in fun toc -> aux_toc toc ~ outer_p : Src_pos . Absolute . origin ; ; |
let find_value loc f = try find_value f with Not_found -> error loc ( Eglobal_undefined ( Value , f ) ) |
let find_type loc f = try find_type f with Not_found -> error loc ( Eglobal_undefined ( Type , f ) ) |
let find_constr loc c = try find_constr c with Not_found -> error loc ( Eglobal_undefined ( Constr , c ) ) |
let find_label loc l = try find_label l with Not_found -> error loc ( Eglobal_undefined ( Label , l ) ) |
let unify loc expected_ty actual_ty = try Ztypes . unify expected_ty actual_ty with | Ztypes . Unify -> error loc ( Etype_clash ( actual_ty , expected_ty ) ) |
let equal_sizes loc expected_size actual_size = try Ztypes . equal_sizes expected_size actual_size with | Ztypes . Unify -> error loc ( Esize_clash ( actual_size , expected_size ) ) |
let unify_expr expr expected_ty actual_ty = try Ztypes . unify expected_ty actual_ty with | Ztypes . Unify -> error expr . e_loc ( Etype_clash ( actual_ty , expected_ty ) ) |
let unify_pat pat expected_ty actual_ty = try Ztypes . unify expected_ty actual_ty with | Ztypes . Unify -> error pat . p_loc ( Etype_clash ( actual_ty , expected_ty ) ) |
let less_than loc actual_k expected_k = try Ztypes . less_than actual_k expected_k with | Ztypes . Unify -> error loc ( Ekind_clash ( actual_k , expected_k ) ) |
let type_is_in_kind loc expected_k ty = try Ztypes . kind expected_k ty with | Ztypes . Unify -> error loc ( Etype_kind_clash ( expected_k , ty ) ) |
let lift loc left_k right_k = try Ztypes . lift left_k right_k with | Ztypes . Unify -> error loc ( Ekind_clash ( right_k , left_k ) ) |
let sort_less_than loc sort expected_k = match expected_k , sort with | Tstatic _ , Sstatic -> ( ) | Tstatic _ , _ -> error loc ( Ekind_clash ( Deftypes . Tany , expected_k ) ) | _ -> ( ) |
let check_is_vec loc actual_ty = try let ty_arg , size = Ztypes . filter_vec actual_ty in ty_arg , size with | Ztypes . Unify -> error loc Esize_of_vec_is_undetermined |
let rec expansive { e_desc = desc } = match desc with | Elocal _ | Eglobal _ | Econst _ | Econstr0 _ -> false | Etuple ( e_list ) -> List . exists expansive e_list | Erecord ( l_e_list ) -> List . exists ( fun ( _ , e ) -> expansive e ) l_e_list | Erecord_access ( e , _ ) | Etypeconstraint ( e , _ ) -> expansive e | Erecord_with ( e , l_e_list ) -> expansive e || List . exists ( fun ( _ , e ) -> expansive e ) l_e_list | _ -> true |
let check_statefull loc expected_k = if not ( Ztypes . is_statefull_kind expected_k ) then error loc Ekind_not_combinatorial |
type state = { mutable s_reset : bool option ; s_parameters : typ list } |
let check_target_state loc expected_reset actual_reset = match expected_reset with | None -> Some ( actual_reset ) | Some ( expected_reset ) -> if expected_reset <> actual_reset then warning loc ( Wreset_target_state ( actual_reset , expected_reset ) ) ; Some ( expected_reset ) |
let turn_vars_into_memories h { dv = dv } = let add n acc = let ( { t_sort = sort ; t_typ = typ } as tentry ) = Env . find n h in match sort with | Smem ( { m_init = Noinit } as m ) -> Env . add n { tentry with t_sort = Smem { m with m_init = InitEq } } acc | Sstatic | Sval | Svar _ | Smem _ -> acc in let first_h = S . fold add dv Env . empty in first_h , Env . append first_h h |
let immediate = function | Ebool _ -> Initial . typ_bool | Eint ( i ) -> Initial . typ_int | Efloat ( i ) -> Initial . typ_float | Echar ( c ) -> Initial . typ_char | Estring ( c ) -> Initial . typ_string | Evoid -> Initial . typ_unit |
let incorporate_into_env first_h h = let mark n { t_sort = sort } = let tentry = Env . find n h in match sort with | Smem ( { m_init = InitEq } as m ) -> tentry . t_sort <- Smem { m with m_init = Noinit } | _ -> ( ) in Env . iter mark first_h |
let vars pat = Vars . fv_pat S . empty S . empty pat |
let var loc h n = try Env . find n h with Not_found -> error loc ( Evar_undefined ( n ) ) |
let typ_of_var loc h n = let { t_typ = typ } = var loc h n in typ |
let last loc h n = let { t_sort = sort ; t_typ = typ } as entry = var loc h n in begin match sort with | Sstatic | Sval | Svar _ | Smem { m_next = Some ( true ) } -> | Smem ( m ) -> entry . t_sort <- Smem { m with m_previous = true } end ; typ |
let derivative loc h n = let { t_typ = typ ; t_sort = sort } as entry = var loc h n in match sort with | Sstatic | Sval | Svar _ -> | Smem ( m ) -> entry . t_sort <- Smem { m with m_kind = Some ( Cont ) } ; typ |
let pluseq loc h n = let ( { t_typ = typ ; t_sort = sort } as entry ) = var loc h n in match sort with | Svar { v_combine = Some _ } -> typ | Sstatic | Sval | Svar { v_combine = None } | Smem { m_combine = None } -> error loc ( Ecombination_function ( n ) ) | Smem ( { m_next = n_opt } as m ) -> match n_opt with | None -> entry . t_sort <- Smem { m with m_next = Some ( false ) } ; typ | Some ( false ) -> typ | Some ( true ) -> error loc ( Ealready_with_different_kinds ( Next , Multi , n ) ) |
let init loc h n = let { t_typ = typ ; t_sort = sort } as entry = var loc h n in match sort with | Sstatic | Sval | Svar _ -> assert false | Smem ( { m_init = i } as m ) -> match i with | Noinit -> entry . t_sort <- Smem { m with m_init = InitEq } ; typ | InitEq -> typ | InitDecl _ -> error loc ( Ealready ( Initial , n ) ) |
let next loc h n = let { t_typ = typ ; t_sort = sort } as entry = var loc h n in match sort with | Sstatic | Sval | Svar _ -> assert false | Smem { m_previous = true } -> error loc ( Enext_forbidden ( n ) ) | Smem ( { m_next = n_opt } as m ) -> match n_opt with | None -> entry . t_sort <- Smem { m with m_next = Some ( true ) } ; typ | Some ( true ) -> typ | Some ( false ) -> error loc ( Ealready_with_different_kinds ( Current , Next , n ) ) |
let def loc h n = let { t_sort = sort } as entry = var loc h n in match sort with | Sstatic | Sval | Svar _ -> ( ) | Smem ( { m_next = n_opt } as m ) -> match n_opt with | None -> entry . t_sort <- Smem { m with m_next = Some ( false ) } | Some ( false ) -> ( ) | Some ( true ) -> error loc ( Ealready_with_different_kinds ( Next , Current , n ) ) |
let global loc expected_k lname = let { qualid = qualid ; info = { value_static = is_static ; value_typ = tys } } = find_value loc lname in less_than loc ( if is_static then Tstatic true else expected_k ) expected_k ; qualid , Ztypes . instance_of_type tys |
let global_with_instance loc expected_k lname = let { qualid = qualid ; info = { value_static = is_static ; value_typ = tys } } = find_value loc lname in less_than loc ( if is_static then Tstatic true else expected_k ) expected_k ; let typ_instance , typ_body = Ztypes . instance_and_vars_of_type tys in qualid , typ_instance , typ_body |
let label loc l = let { qualid = qualid ; info = tys_label } = find_label loc l in qualid , Ztypes . label_instance tys_label |
let constr loc c = let { qualid = qualid ; info = tys_c } = find_constr loc c in qualid , Ztypes . constr_instance tys_c |
let rec get_all_labels loc ty = match ty . t_desc with | Tconstr ( qual , _ , _ ) -> let { info = { type_desc = ty_c } } = find_type loc ( Lident . Modname ( qual ) ) in begin match ty_c with Record_type ( l ) -> l | _ -> assert false end | Tlink ( link ) -> get_all_labels loc link | _ -> assert false |
let check_definitions_for_every_name defined_names n_list = List . fold_left ( fun { dv = dv ; di = di ; der = der ; nv = nv ; mv = mv } { vardec_name = n ; vardec_default = d_opt ; vardec_loc = loc } -> let in_dv = S . mem n dv in let in_di = S . mem n di in let in_der = S . mem n der in let in_nv = S . mem n nv in let in_mv = S . mem n mv in if not ( in_dv || in_di || in_der || in_nv || in_mv ) then error loc ( Eequation_is_missing ( n ) ) ; { dv = if in_dv then S . remove n dv else dv ; di = if in_di then S . remove n di else di ; der = if in_der then S . remove n der else der ; nv = if in_nv then S . remove n nv else nv ; mv = if in_mv then S . remove n mv else mv } ) defined_names n_list |
let combine loc expected_ty lname = let { qualid = qualid ; info = { value_typ = tys } } = find_value loc lname in let ty = Ztypes . instance_of_type tys in let ty_combine = Ztypes . type_of_combine ( ) in unify loc ty_combine ty |
let constant loc expected_k expected_ty = function | Cimmediate ( i ) -> let actual_ty = immediate ( i ) in unify loc expected_ty actual_ty | Cglobal ( lname ) -> let qualid , actual_ty = global loc expected_k lname in unify loc expected_ty actual_ty |
let vardec_list expected_k n_list inames = let default loc expected_ty c_opt = function | Init ( v ) -> if not ( Ztypes . is_statefull_kind expected_k ) then error loc Ekind_not_combinatorial ; constant loc expected_k expected_ty v ; Deftypes . Smem ( Deftypes . cmem c_opt { empty_mem with m_init = InitDecl ( v ) } ) | Default ( v ) -> constant loc expected_k expected_ty v ; Deftypes . default ( Some ( v ) ) c_opt in let vardec h0 { vardec_name = n ; vardec_default = d_opt ; vardec_combine = c_opt ; vardec_loc = loc } = let expected_ty = Ztypes . new_var ( ) in Zmisc . optional_unit ( combine loc ) expected_ty c_opt ; let sort = match d_opt with | Some ( d ) -> default loc expected_ty c_opt d | None -> match expected_k with | Tstatic _ -> Deftypes . static | Tany | Tdiscrete false -> Deftypes . default None c_opt | Tdiscrete true | Tcont | Tproba -> ( if S . mem n inames then Deftypes . imem else Deftypes . empty_mem ) ) in Env . add n { t_typ = expected_ty ; t_sort = sort } h0 in List . fold_left vardec Env . empty n_list |
let rec build ( names , inames ) { eq_desc = desc } = let block_with_bounded ( names , inames ) let vardec acc { vardec_name = n } = S . add n acc in let bounded = List . fold_left vardec S . empty b_vars in let ( local_names , local_inames ) = build_list ( S . empty , S . empty ) eq_list in bounded , ( S . union names ( S . diff local_names bounded ) , S . union inames ( S . diff local_inames bounded ) ) in let block ( names , inames ) b = snd ( block_with_bounded ( names , inames ) b ) in match desc with | EQeq ( p , _ ) -> Vars . fv_pat S . empty names p , inames | EQder ( n , _ , _ , _ ) | EQpluseq ( n , _ ) | EQnext ( n , _ , _ ) | EQemit ( n , _ ) -> S . add n names , inames | EQinit ( n , _ ) -> S . add n names , S . add n inames | EQreset ( eq_list , _ ) | EQand ( eq_list ) | EQbefore ( eq_list ) -> build_list ( names , inames ) eq_list | EQblock ( b ) -> block ( names , inames ) b | EQpresent ( ph_list , b_opt ) -> let handler ( names , inames ) { p_body = b } = block ( names , inames ) b in let names , inames = List . fold_left handler ( names , inames ) ph_list in Zmisc . optional block ( names , inames ) b_opt | EQmatch ( _ , _ , mh_list ) -> let handler ( names , inames ) { m_body = b } = block ( names , inames ) b in List . fold_left handler ( names , inames ) mh_list | EQautomaton ( is_weak , sh_list , _ ) -> let escape ( names , inames ) { e_block = b_opt } = Zmisc . optional block ( names , inames ) b_opt in let handler ( names , inames ) { s_body = b ; s_trans = esc_list } = let bounded , ( names , inames ) = block_with_bounded ( names , inames ) b in let esc_names , esc_inames = List . fold_left escape ( names , inames ) esc_list in S . union names ( if is_weak then S . diff esc_names bounded else esc_names ) , S . union inames ( if is_weak then S . diff esc_inames bounded else esc_inames ) in List . fold_left handler ( names , inames ) sh_list | EQforall { for_index = in_list ; for_init = init_list } -> let index ( names , inames ) { desc = desc } = match desc with | Einput _ | Eindex _ -> names , inames | Eoutput ( _ , n ) -> S . add n names , inames in let init ( names , inames ) { desc = desc } = match desc with | Einit_last ( n , _ ) -> S . add n names , inames in let names , inames = List . fold_left index ( names , inames ) in_list in List . fold_left init ( names , inames ) init_list List . fold_left build ( names , inames ) eq_list |
let env_of_eq_list expected_k eq_list = let names , inames = build_list ( S . empty , S . empty ) eq_list in S . fold ( fun n acc -> let sort = match expected_k with | Deftypes . Tstatic _ -> Deftypes . static | Deftypes . Tany | Deftypes . Tdiscrete false -> Deftypes . variable | Deftypes . Tcont | Deftypes . Tdiscrete true | Deftypes . Tproba -> else Deftypes . Smem ( Deftypes . empty_mem ) in Env . add n { t_typ = Ztypes . new_var ( ) ; t_sort = sort } acc ) names Env . empty |
let intro_sort_of_var expected_k = match expected_k with | Deftypes . Tstatic _ -> Deftypes . static | Deftypes . Tany | Deftypes . Tdiscrete false -> Deftypes . Sval | Deftypes . Tcont | Deftypes . Tdiscrete true | Deftypes . Tproba -> Deftypes . Smem ( Deftypes . empty_mem ) |
let env_of_scondpat expected_k scpat = let rec env_of acc { desc = desc } = match desc with | Econdand ( sc1 , sc2 ) -> env_of ( env_of acc sc1 ) sc2 | Econdor ( sc , _ ) | Econdon ( sc , _ ) -> env_of acc sc | Econdexp _ -> acc | Econdpat ( _ , pat ) -> Vars . fv_pat S . empty acc pat in let acc = env_of S . empty scpat in S . fold ( fun n acc -> Env . add n { t_typ = Ztypes . new_var ( ) ; t_sort = intro_sort_of_var expected_k } acc ) acc Env . empty |
let env_of_statepat expected_k spat = let rec env_of acc { desc = desc } = match desc with | Estate0pat _ -> acc | Estate1pat ( _ , l ) -> List . fold_left ( fun acc n -> S . add n acc ) acc l in let acc = env_of S . empty spat in S . fold ( fun n acc -> Env . add n { t_typ = Ztypes . new_var ( ) ; t_sort = intro_sort_of_var expected_k } acc ) acc Env . empty |
let env_of_pattern expected_k h0 pat = let acc = Vars . fv_pat S . empty S . empty pat in S . fold ( fun n acc -> Env . add n { t_typ = Ztypes . new_var ( ) ; t_sort = intro_sort_of_var expected_k } acc ) acc h0 |
let env_of_pattern_list expected_k env p_list = let p_list , p = Zmisc . firsts p_list in let env = List . fold_left ( env_of_pattern ( Deftypes . Tstatic true ) ) env p_list in env_of_pattern expected_k env p |
let env_of_pattern expected_k pat = env_of_pattern expected_k Env . empty pat |
let rec pattern h ( { p_desc = desc ; p_loc = loc } as pat ) ty = match desc with | Ewildpat -> pat . p_typ <- ty | Econstpat ( im ) -> unify_pat pat ty ( immediate im ) ; pat . p_typ <- ty | Econstr0pat ( c0 ) -> let qualid , { constr_res = ty_res ; constr_arity = n } = constr loc c0 in if n <> 0 then error loc ( Econstr_arity ( c0 , n , 0 ) ) ; unify_pat pat ty ty_res ; pat . p_desc <- Econstr0pat ( Lident . Modname ( qualid ) ) ; pat . p_typ <- ty | Econstr1pat ( c1 , pat_list ) -> let qualid , { constr_arg = ty_list ; constr_res = ty_res ; constr_arity = n } = constr loc c1 in let actual_n = List . length pat_list in if n <> actual_n then error loc ( Econstr_arity ( c1 , n , actual_n ) ) ; unify_pat pat ty ty_res ; pat . p_desc <- Econstr1pat ( Lident . Modname ( qualid ) , pat_list ) ; pat . p_typ <- ty ; List . iter2 ( pattern h ) pat_list ty_list | Evarpat ( x ) -> unify_pat pat ty ( typ_of_var loc h x ) ; pat . p_typ <- ty | Etuplepat ( pat_list ) -> let ty_list = List . map ( fun _ -> new_var ( ) ) pat_list in unify_pat pat ty ( product ty_list ) ; pat . p_typ <- ty ; List . iter2 ( pattern h ) pat_list ty_list | Etypeconstraintpat ( p , typ_expr ) -> let expected_typ = Ztypes . instance_of_type ( Interface . scheme_of_type typ_expr ) in unify_pat pat expected_typ ty ; pat . p_typ <- ty ; pattern h p ty | Erecordpat ( label_pat_list ) -> pat . p_typ <- ty ; let label_pat_list = List . map ( fun ( lab , pat_label ) -> let qualid , { label_arg = ty_arg ; label_res = ty_res } = label pat . p_loc lab in unify_pat pat_label ty ty_arg ; pattern h pat_label ty_res ; Lident . Modname ( qualid ) , pat_label ) label_pat_list in pat . p_desc <- Erecordpat ( label_pat_list ) | Ealiaspat ( p , x ) -> unify_pat pat ty ( typ_of_var loc h x ) ; pat . p_typ <- ty ; pattern h p ty | Eorpat ( p1 , p2 ) -> pat . p_typ <- ty ; pattern h p1 ty ; pattern h p2 ty |
let pattern_list h pat_list ty_list = List . iter2 ( pattern h ) pat_list ty_list |
let check_total_pattern p = let is_exhaustive = Patternsig . check_activate p . p_loc p in if not is_exhaustive then error p . p_loc Epattern_not_total |
let check_total_pattern_list p_list = List . iter check_total_pattern p_list |
let match_handlers body loc expected_k h total m_handlers pat_ty ty = let handler ( { m_pat = pat ; m_body = b } as mh ) = let h0 = env_of_pattern expected_k pat in pattern h0 pat pat_ty ; mh . m_env <- h0 ; let h = Env . append h0 h in body expected_k h b ty in let defined_names_list = List . map handler m_handlers in let is_exhaustive = ! total || ( Patternsig . check_match_handlers loc m_handlers ) in let defined_names_list = if is_exhaustive then defined_names_list else Deftypes . empty :: defined_names_list in total := is_exhaustive ; Total . merge loc h defined_names_list |
let present_handlers scondpat body loc expected_k h p_h_list b_opt expected_ty = let handler ( { p_cond = scpat ; p_body = b } as ph ) = let h0 = env_of_scondpat expected_k scpat in let h = Env . append h0 h in let is_zero = Ztypes . is_continuous_kind expected_k in scondpat expected_k is_zero h scpat ; ph . p_zero <- is_zero ; ph . p_env <- h0 ; body ( Ztypes . lift_to_discrete expected_k ) h b expected_ty in let defined_names_list = List . map handler p_h_list in let defined_names_list = match b_opt with | None -> Deftypes . empty :: defined_names_list | Some ( b ) -> let defined_names = body expected_k h b expected_ty in defined_names :: defined_names_list in Total . merge loc h defined_names_list |
let rec expression expected_k h ( { e_desc = desc ; e_loc = loc } as e ) = let ty = match desc with | Econst ( i ) -> immediate i | Elocal ( x ) -> let { t_typ = typ ; t_sort = sort } = var loc h x in sort_less_than loc sort expected_k ; typ | Eglobal { lname = lname } -> let qualid , typ_instance , ty = global_with_instance loc expected_k lname in e . e_desc <- Eglobal { lname = Lident . Modname ( qualid ) ; typ_instance = typ_instance } ; ty | Elast ( x ) -> last loc h x | Etuple ( e_list ) -> product ( List . map ( expression expected_k h ) e_list ) | Eop ( Eaccess , [ e1 ; e2 ] ) -> let ty = expression expected_k h e1 in let ty_arg , _ = check_is_vec e1 . e_loc ty in expect expected_k h e2 Initial . typ_int ; ty_arg | Eop ( Eupdate , [ e1 ; i ; e2 ] ) -> let ty = expression expected_k h e1 in let ty_arg , _ = check_is_vec e1 . e_loc ty in expect expected_k h i Initial . typ_int ; expect expected_k h e2 ty_arg ; ty | Eop ( Eslice ( s1 , s2 ) , [ e ] ) -> let s1 = size h s1 in let s2 = size h s2 in let ty = expression expected_k h e in let ty_arg , _ = check_is_vec e . e_loc ty in Ztypes . vec ty_arg ( Ztypes . plus ( Ztypes . minus s2 s1 ) ( Ztypes . const 1 ) ) | Eop ( Econcat , [ e1 ; e2 ] ) -> let ty1 = expression expected_k h e1 in let ty_arg1 , s1 = check_is_vec e1 . e_loc ty1 in let ty2 = expression expected_k h e2 in let ty_arg2 , s2 = check_is_vec e2 . e_loc ty2 in unify_expr e2 ty_arg1 ty_arg2 ; Ztypes . vec ty_arg1 ( Ztypes . plus s1 s2 ) | Eop ( op , e_list ) -> operator expected_k h loc op e_list | Eapp ( { app_statefull = is_statefull } , e , e_list ) -> apply loc is_statefull expected_k h e e_list | Econstr0 ( c0 ) -> let qualid , { constr_res = ty_res ; constr_arity = n } = constr loc c0 in if n <> 0 then error loc ( Econstr_arity ( c0 , n , 0 ) ) ; e . e_desc <- Econstr0 ( Lident . Modname ( qualid ) ) ; ty_res | Econstr1 ( c1 , e_list ) -> let qualid , { constr_arg = ty_list ; constr_res = ty_res ; constr_arity = n } = constr loc c1 in let actual_arity = List . length e_list in if n <> actual_arity then error loc ( Econstr_arity ( c1 , n , actual_arity ) ) ; List . iter2 ( expect expected_k h ) e_list ty_list ; e . e_desc <- Econstr1 ( Lident . Modname ( qualid ) , e_list ) ; ty_res | Erecord_access ( e1 , lab ) -> let qualid , { label_arg = ty_arg ; label_res = ty_res } = label loc lab in expect expected_k h e1 ty_arg ; e . e_desc <- Erecord_access ( e1 , Lident . Modname ( qualid ) ) ; ty_res | Erecord ( label_e_list ) -> let ty = new_var ( ) in let label_e_list = List . map ( fun ( lab , e_label ) -> let qualid , { label_arg = ty_arg ; label_res = ty_res } = label loc lab in unify_expr e ty ty_arg ; expect expected_k h e_label ty_res ; ( Lident . Modname ( qualid ) , e_label ) ) label_e_list in e . e_desc <- Erecord ( label_e_list ) ; let label_desc_list = get_all_labels loc ty in if List . length label_e_list <> List . length label_desc_list then error loc Esome_labels_are_missing ; ty | Erecord_with ( e1 , label_e_list ) -> let ty = new_var ( ) in let label_e_list = List . map ( fun ( lab , e_label ) -> let qualid , { label_arg = ty_arg ; label_res = ty_res } = label loc lab in unify_expr e ty ty_arg ; expect expected_k h e_label ty_res ; ( Lident . Modname ( qualid ) , e_label ) ) label_e_list in e . e_desc <- Erecord_with ( e1 , label_e_list ) ; ty | Etypeconstraint ( exp , typ_expr ) -> let expected_typ = Ztypes . instance_of_type ( Interface . scheme_of_type typ_expr ) in expect expected_k h exp expected_typ ; expected_typ | Elet ( l , e ) -> let h = local expected_k h l in expression expected_k h e | Eblock ( b , e ) -> let h , _ = block_eq_list expected_k h b in expression expected_k h e | Eseq ( e1 , e2 ) -> ignore ( expression expected_k h e1 ) ; expression expected_k h e2 | Eperiod ( p ) -> less_than loc Tcont expected_k ; period ( Tstatic ( true ) ) h p ; Ztypes . zero_type expected_k | Ematch ( total , e , m_h_list ) -> let expected_pat_ty = expression expected_k h e in let expected_ty = new_var ( ) in ignore ( match_handler_exp_list loc expected_k h total m_h_list expected_pat_ty expected_ty ) ; expected_ty | Epresent ( p_h_list , e_opt ) -> let expected_ty = new_var ( ) in ignore ( present_handler_exp_list loc expected_k h p_h_list e_opt expected_ty ) ; expected_ty in type_is_in_kind loc expected_k ty ; e . e_typ <- ty ; ty match desc with | Sconst ( i ) -> Ztypes . const i | Sglobal ( ln ) -> let qualid , _ , typ_body = global_with_instance loc ( Tstatic ( true ) ) ln in unify loc Initial . typ_int typ_body ; Ztypes . global ( qualid ) | Sname ( x ) -> let { t_typ = typ ; t_sort = sort } = var loc h x in sort_less_than loc sort ( Tstatic ( true ) ) ; unify loc Initial . typ_int typ ; Ztypes . name x | Sop ( Splus , s1 , s2 ) -> let s1 = size h s1 in let s2 = size h s2 in Ztypes . plus s1 s2 | Sop ( Sminus , s1 , s2 ) -> let s1 = size h s1 in let s2 = size h s2 in Ztypes . minus s1 s2 match desc with | Econst ( Eint ( i ) ) -> Tconst ( i ) | Elocal ( n ) -> Tname ( n ) | Eglobal { lname = Lident . Modname ( qualid ) } -> Tglobal ( qualid ) | Eapp ( _ , { e_desc = Eglobal { lname = Lident . Modname ( qualid ) } } , [ e1 ; e2 ] ) when qualid = Initial . stdlib_name " " + -> Top ( Tplus , size_of_exp e1 , size_of_exp e2 ) | Eapp ( _ , { e_desc = Eglobal { lname = Lident . Modname ( qualid ) } } , [ e1 ; e2 ] ) when qualid = Initial . stdlib_name " " - -> Top ( Tminus , size_of_exp e1 , size_of_exp e2 ) | _ -> error loc Enot_a_size_expression let actual_k , ty_args , ty_res = match op with | Eifthenelse -> let ty = new_var ( ) in Tany , [ Initial . typ_bool ; ty ; ty ] , ty | Eunarypre -> let ty = new_var ( ) in Tdiscrete ( true ) , [ ty ] , ty | ( Eminusgreater | Efby ) -> let ty = new_var ( ) in Tdiscrete ( true ) , [ ty ; ty ] , ty | ( Eup | Ehorizon ) -> Tcont , [ Initial . typ_float ] , Initial . typ_zero | Etest -> let ty = new_var ( ) in Tany , [ Initial . typ_signal ty ] , Initial . typ_bool | Edisc -> let ty = new_var ( ) in Tcont , [ ty ] , Initial . typ_zero | Einitial -> Tcont , [ ] , Initial . typ_zero | Eatomic -> let ty = new_var ( ) in expected_k , [ ty ] , ty | Eaccess | Eupdate | Eslice _ | Econcat -> assert false in less_than loc actual_k expected_k ; List . iter2 ( expect expected_k h ) e_list ty_args ; ty_res expect expected_k h p2 Initial . typ_float ; match p1_opt with None -> ( ) | Some ( p1 ) -> expect expected_k h p1 Initial . typ_float let actual_ty = expression expected_k h e in unify_expr e expected_ty actual_ty let ty_fct = expression ( Tstatic ( true ) ) h e in if is_statefull then begin check_statefull loc expected_k ; unify_expr e ( Ztypes . run_type expected_k ) ty_fct end ; let intro_k = Ztypes . intro expected_k in let rec args ty_fct = function | [ ] -> ty_fct | arg :: arg_list -> let actual_k , n_opt , ty1 , ty2 = try Ztypes . filter_arrow intro_k ty_fct with Unify -> error loc ( Eapplication_of_non_function ) in let expected_k = lift loc expected_k actual_k in expect expected_k h arg ty1 ; let ty2 = match n_opt with | None -> ty2 | Some ( n ) -> subst_in_type ( Env . singleton n ( size_of_exp arg ) ) ty2 in args ty2 arg_list in args ty_fct arg_list let defnames = match desc with | EQeq ( p , e ) -> let ty_e = expression expected_k h e in pattern h p ty_e ; check_total_pattern p ; let dv = vars p in S . iter ( def loc h ) dv ; { Deftypes . empty with dv = dv } | EQpluseq ( n , e ) -> let actual_ty = expression expected_k h e in let expected_ty = pluseq loc h n in unify loc expected_ty actual_ty ; { Deftypes . empty with mv = S . singleton n } | EQinit ( n , e0 ) -> check_statefull loc expected_k ; let actual_ty = init loc h n in expect ( Ztypes . lift_to_discrete expected_k ) h e0 actual_ty ; { Deftypes . empty with di = S . singleton n } | EQnext ( n , e , e0_opt ) -> less_than loc ( Tdiscrete ( true ) ) expected_k ; let actual_ty = next loc h n in expect expected_k h e actual_ty ; let di = match e0_opt with | None -> S . empty | Some ( e ) -> expect expected_k h e actual_ty ; ignore ( init loc h n ) ; S . singleton n in { Deftypes . empty with nv = S . singleton n ; di = di } | EQder ( n , e , e0_opt , p_h_e_list ) -> less_than loc Tcont expected_k ; let actual_ty = derivative loc h n in unify loc Initial . typ_float actual_ty ; expect expected_k h e actual_ty ; let di = match e0_opt with | None -> S . empty | Some ( e ) -> expect ( Ztypes . lift_to_discrete expected_k ) h e Initial . typ_float ; ignore ( init loc h n ) ; S . singleton n in ignore ( present_handler_exp_list loc expected_k h p_h_e_list None Initial . typ_float ) ; { Deftypes . empty with di = di ; der = S . singleton n } | EQautomaton ( is_weak , s_h_list , se_opt ) -> check_statefull loc expected_k ; automaton_handlers is_weak loc expected_k h s_h_list se_opt | EQmatch ( total , e , m_h_list ) -> let expected_pat_ty = expression expected_k h e in match_handler_block_eq_list loc expected_k h total m_h_list expected_pat_ty | EQpresent ( p_h_list , b_opt ) -> present_handler_block_eq_list loc expected_k h p_h_list b_opt | EQreset ( eq_list , e ) -> expect expected_k h e ( Ztypes . zero_type expected_k ) ; equation_list expected_k h eq_list | EQand ( eq_list ) | EQbefore ( eq_list ) -> equation_list expected_k h eq_list | EQemit ( n , e_opt ) -> less_than loc expected_k ( Ztypes . lift_to_discrete expected_k ) ; let ty_e = new_var ( ) in let ty_name = typ_of_var loc h n in begin match e_opt with | None -> unify loc ( Initial . typ_signal Initial . typ_unit ) ty_name | Some ( e ) -> unify loc ( Initial . typ_signal ty_e ) ty_name ; expect expected_k h e ty_e end ; { Deftypes . empty with dv = S . singleton n } | EQblock ( b_eq_list ) -> snd ( block_eq_list expected_k h b_eq_list ) | EQforall ( { for_index = i_list ; for_init = init_list ; for_body = b_eq_list } as body ) -> let merge ( { dv = dv ; di = di ; der = der ; nv = nv ; mv = mv } as defnames ) h init_h out_h xi_out_x = let out_set = Env . fold ( fun x _ acc -> S . add x acc ) out_h S . empty in let out_not_defined = S . diff out_set ( Deftypes . names S . empty defnames ) in if not ( S . is_empty out_not_defined ) then error loc ( Eequation_is_missing ( S . choose out_not_defined ) ) ; let x_of_xi xi = try Env . find xi xi_out_x with Not_found -> xi in let out xi acc = try S . add ( Env . find xi xi_out_x ) acc with Not_found -> acc in let belong_to_init_out xi = if not ( ( Env . mem xi init_h ) || ( Env . mem xi out_h ) ) then error loc ( Ealready_in_forall ( xi ) ) in let belong_to_out_not_init xi = if not ( Env . mem xi out_h ) || ( Env . mem xi init_h ) then error loc ( Ealready_in_forall ( xi ) ) in S . iter belong_to_init_out dv ; S . iter belong_to_init_out nv ; S . iter belong_to_init_out der ; S . iter belong_to_out_not_init di ; S . iter ( def loc h ) ( S . fold out dv S . empty ) ; S . iter ( fun n -> ignore ( init loc h n ) ) ( S . fold out di S . empty ) ; S . iter ( fun n -> ignore ( derivative loc h n ) ) ( S . fold out der S . empty ) ; { dv = S . map x_of_xi dv ; di = S . map x_of_xi di ; der = S . map x_of_xi der ; nv = S . map x_of_xi nv ; mv = S . map x_of_xi mv } in let sort = if Ztypes . is_statefull_kind expected_k then Deftypes . Smem Deftypes . empty_mem else Deftypes . variable in let index ( in_h , out_h , xi_out_x , size_opt ) { desc = desc ; loc = loc } = let size_of loc size_opt = match size_opt with | None -> error loc Esize_of_vec_is_undetermined | Some ( actual_size ) -> actual_size in match desc with | Einput ( xi , e ) -> let ty = Ztypes . new_var ( ) in let si = size_of loc size_opt in expect Tany h e ( Ztypes . vec ty si ) ; Env . add xi { t_typ = ty ; t_sort = Sval } in_h , out_h , xi_out_x , size_opt | Eoutput ( xi , x ) -> let ty_xi = Ztypes . new_var ( ) in let ty_x = typ_of_var loc h x in let si = size_of loc size_opt in unify loc ( Ztypes . vec ty_xi si ) ty_x ; in_h , Env . add xi { t_typ = ty_xi ; t_sort = sort } out_h , Env . add xi x xi_out_x , size_opt | Eindex ( i , e0 , e1 ) -> expect ( Tstatic ( true ) ) h e0 Initial . typ_int ; expect ( Tstatic ( true ) ) h e1 Initial . typ_int ; let e0 = size_of_exp e0 in let e1 = size_of_exp e1 in let actual_size = Ztypes . plus ( Ztypes . minus e1 e0 ) ( Ztypes . const 1 ) in let size_opt = match size_opt with | None -> Some ( actual_size ) | Some ( expected_size ) -> equal_sizes loc expected_size actual_size ; size_opt in Env . add i { t_typ = Initial . typ_int ; t_sort = Sval } in_h , out_h , xi_out_x , size_opt in let init init_h { desc = desc ; loc = loc } = match desc with | Einit_last ( i , e ) -> let ty = typ_of_var loc h i in expect expected_k h e ty ; Env . add i { t_typ = ty ; t_sort = Deftypes . memory } init_h in let init_h = List . fold_left init Env . empty init_list in let in_h , out_h , xi_out_x , _ = List . fold_left index ( Env . empty , Env . empty , Env . empty , None ) i_list in body . for_in_env <- in_h ; body . for_out_env <- out_h ; let h_eq_list = Env . append in_h ( Env . append out_h ( Env . append init_h h ) ) in let _ , defnames = block_eq_list expected_k h_eq_list b_eq_list in merge defnames h init_h out_h xi_out_x in eq . eq_write <- defnames ; defnames List . fold_left ( fun defined_names eq -> Total . join eq . eq_loc ( equation expected_k h eq ) defined_names ) Deftypes . empty eq_list present_handlers scondpat ( fun expected_k h e expected_ty -> expect expected_k h e expected_ty ; Deftypes . empty ) loc expected_k h p_h_list e0_opt expected_ty present_handlers scondpat ( fun expected_k h b _ -> snd ( block_eq_list expected_k h b ) ) loc expected_k h p_h_list b_opt Initial . typ_unit match_handlers ( fun expected_k h b _ -> snd ( block_eq_list expected_k h b ) ) loc expected_k h total m_h_list pat_ty Initial . typ_unit match_handlers ( fun expected_k h e expected_ty -> expect expected_k h e expected_ty ; Deftypes . empty ) loc expected_k h total m_h_list pat_ty ty ( { b_vars = n_list ; b_locals = l_list ; b_body = eq_list } as b ) = let _ , inames = build_list ( S . empty , S . empty ) eq_list in let h0 = vardec_list expected_k n_list inames in let h = Env . append h0 h in let new_h = List . fold_left ( local expected_k ) h l_list in let defined_names = equation_list expected_k new_h eq_list in let defined_names = check_definitions_for_every_name defined_names n_list in b . b_write <- defined_names ; b . b_env <- h0 ; new_h , defined_names let h0 = env_of_eq_list expected_k eq_list in l . l_env <- h0 ; let new_h = Env . append h0 h in ignore ( equation_list expected_k new_h eq_list ) ; Env . append h0 h let rec typrec expected_k is_zero_type scpat = match scpat . desc with | Econdand ( sc1 , sc2 ) -> typrec expected_k is_zero_type sc1 ; typrec expected_k is_zero_type sc2 | Econdor ( sc1 , sc2 ) -> typrec expected_k is_zero_type sc1 ; typrec expected_k is_zero_type sc2 | Econdexp ( e ) -> let expected_ty = if is_zero_type then Initial . typ_zero else Initial . typ_bool in ignore ( expect expected_k h e expected_ty ) | Econdpat ( e_cond , pat ) -> let ty = new_var ( ) in ignore ( expect expected_k h e_cond ( Initial . typ_signal ty ) ) ; pattern h pat ty | Econdon ( sc1 , e ) -> typrec expected_k is_zero_type sc1 ; ignore ( expect ( Ztypes . on_type expected_k ) h e Initial . typ_bool ) in typrec expected_k is_zero_type scpat match state . desc with | Estate0 ( s ) -> begin try let ( { s_reset = expected_reset ; s_parameters = args } as r ) = Env . find s def_states in if args <> [ ] then error state . loc ( Estate_arity_clash ( s , 0 , List . length args ) ) ; r . s_reset <- check_target_state state . loc expected_reset actual_reset with | Not_found -> error state . loc ( Estate_unbound s ) end | Estate1 ( s , l ) -> let ( { s_reset = expected_reset ; s_parameters = args } as r ) = try Env . find s def_states with | Not_found -> error state . loc ( Estate_unbound s ) in begin try List . iter2 ( fun e expected_ty -> ignore ( expect Tany h e expected_ty ) ) l args ; r . s_reset <- check_target_state state . loc expected_reset actual_reset with | Invalid_argument _ -> error state . loc ( Estate_arity_clash ( s , List . length l , List . length args ) ) end let mark ( { s_state = statepat } as handler ) = let { s_reset = r } = Env . find ( Total . Automaton . statepatname statepat ) def_states in let v = match r with | None | Some ( false ) -> false | Some ( true ) -> true in handler . Zelus . s_reset <- v in List . iter mark state_handlers Total . Automaton . check_all_states_are_accessible loc state_handlers ; let t = Total . Automaton . table state_handlers in let addname acc { s_state = statepat } = match statepat . desc with | Estate0pat ( s ) -> Env . add s { s_reset = None ; s_parameters = [ ] } acc | Estate1pat ( s , l ) -> Env . add s { s_reset = None ; s_parameters = ( List . map ( fun _ -> new_var ( ) ) l ) } acc in let def_states = List . fold_left addname Env . empty state_handlers in let { s_state = statepat } = List . hd state_handlers in begin match se_opt with | None -> begin match statepat . desc with | Estate1pat _ -> error statepat . loc Estate_initial | Estate0pat _ -> ( ) end | Some ( se ) -> typing_state h def_states true se end ; let is_zero_type = Ztypes . is_continuous_kind expected_k in let typing_handler h ( { s_state = statepat ; s_body = b ; s_trans = trans } as s ) = let escape source_state h expected_k ( { e_cond = scpat ; e_reset = r ; e_block = b_opt ; e_next_state = state } as esc ) = let h0 = env_of_scondpat expected_k scpat in let h = Env . append h0 h in scondpat expected_k is_zero_type h scpat ; esc . e_zero <- is_zero_type ; esc . e_env <- h0 ; let h , defined_names = match b_opt with | None -> h , Deftypes . empty | Some ( b ) -> block_eq_list ( Tdiscrete ( true ) ) h b in typing_state h def_states r state ; let statename = if is_weak then source_state else Total . Automaton . statename state in Total . Automaton . add_transition is_weak h statename defined_names t in let h0 = env_of_statepat expected_k statepat in s . s_env <- h0 ; begin match statepat . desc with | Estate0pat _ -> ( ) | Estate1pat ( s , n_list ) -> let { s_parameters = ty_list } = Env . find s def_states in List . iter2 ( fun n ty -> unify statepat . loc ( typ_of_var statepat . loc h0 n ) ty ) n_list ty_list ; end ; let h = Env . append h0 h in let new_h , defined_names = block_eq_list expected_k h b in let source_state = Total . Automaton . statepatname statepat in Total . Automaton . add_state source_state defined_names t ; List . iter ( escape source_state new_h expected_k ) trans ; defined_names in let first_handler = List . hd state_handlers in let remaining_handlers = List . tl state_handlers in let defined_names = typing_handler h first_handler in let first_h , new_h = if is_weak then turn_vars_into_memories h defined_names else Env . empty , h in let defined_names_list = List . map ( typing_handler new_h ) remaining_handlers in let defined_names = Total . Automaton . check loc new_h t in List . iter2 ( fun { s_body = { b_write = _ } as b } defined_names -> b . b_write <- defined_names ) state_handlers ( defined_names :: defined_names_list ) ; incorporate_into_env first_h h ; mark_reset_state def_states state_handlers ; defined_names |
let no_unbounded_name loc free_in_ty ty = if not ( S . is_empty free_in_ty ) then let n = S . choose free_in_ty in error loc ( Esize_parameter_cannot_be_generalized ( n , ty ) ) else ty |
let funtype loc expected_k pat_list ty_list ty_res = let rec arg pat_list ty_list fv_in_ty_res = match pat_list , ty_list with | [ ] , [ ] -> [ ] , fv_in_ty_res | pat :: pat_list , ty_arg :: ty_list -> let ty_res_list , fv_in_ty_res = arg pat_list ty_list fv_in_ty_res in let fv_pat = Vars . fv_pat S . empty S . empty pat in let opt_name , fv_in_ty_res = let fv_inter = S . inter fv_pat fv_in_ty_res in if S . is_empty fv_inter then None , fv_in_ty_res else match pat . p_desc with | Evarpat ( n ) -> Some ( n ) , S . remove n fv_in_ty_res | _ -> error pat . p_loc Esize_parameter_must_be_a_name in ( opt_name , ty_arg ) :: ty_res_list , fv fv_in_ty_res ty_arg | _ -> assert false in let ty_arg_list , fv_in_ty_res = arg pat_list ty_list ( fv S . empty ty_res ) in let ty_res = funtype_list expected_k ty_arg_list ty_res in no_unbounded_name loc fv_in_ty_res ty_res |
let constdecl f is_static e = let expected_k = if is_static then Tstatic ( true ) else Tdiscrete ( false ) in Zmisc . push_binding_level ( ) ; let ty = expression expected_k Env . empty e in Zmisc . pop_binding_level ( ) ; let tys = Ztypes . gen ( not ( expansive e ) ) ty in tys |
let fundecl loc f ( { f_kind = k ; f_atomic = is_atomic ; f_args = pat_list ; f_body = e } as body ) = Zmisc . push_binding_level ( ) ; let expected_k = Interface . kindtype k in let h0 = env_of_pattern_list expected_k Env . empty pat_list in body . f_env <- h0 ; let ty_p_list = List . map ( fun _ -> new_var ( ) ) pat_list in pattern_list h0 pat_list ty_p_list ; check_total_pattern_list pat_list ; let ty_res = expression expected_k h0 e in Zmisc . pop_binding_level ( ) ; let ty_res = funtype loc expected_k pat_list ty_p_list ty_res in let tys = Ztypes . gen true ty_res in tys |
let implementation ff is_first impl = try match impl . desc with | Econstdecl ( f , is_static , e ) -> let tys = constdecl f is_static e in if is_first then Interface . add_type_of_value ff impl . loc f is_static tys else Interface . update_type_of_value ff impl . loc f is_static tys | Efundecl ( f , body ) -> let tys = fundecl impl . loc f body in if is_first then Interface . add_type_of_value ff impl . loc f true tys else Interface . update_type_of_value ff impl . loc f true tys | Eopen ( modname ) -> if is_first then Modules . open_module modname | Etypedecl ( f , params , ty ) -> if is_first then Interface . typedecl ff impl . loc f params ty with | Typerrors . Error ( loc , err ) -> if is_first then Typerrors . message loc err else begin Format . eprintf " [ @ Internal error : type error during the second step \ n \ after static reduction and inlining \ n \ Be carreful , the localisation of errors is misleading . . ] " ; @@@ Typerrors . message loc err end |
let implementation_list ff is_first impl_list = Zmisc . no_warning := not is_first ; List . iter ( implementation ff is_first ) impl_list ; Zmisc . no_warning := not is_first ; impl_list |
let badwords = [ " abandonned " ; " abandonning " ; " abbrevation " ; " abbrevations " ; " abigious " ; " abilties " ; " abilty " ; " abitrate " ; " abolute " ; " abov " ; " absense " ; " absolut " ; " absoulte " ; " acccept " ; " acccepted " ; " acccepting " ; " acccepts " ; " acccess " ; " acceleratoin " ; " accelleration " ; " accesing " ; " accesnt " ; " accessable " ; " accesss " ; " accidentaly " ; " accidently " ; " accidentually " ; " accoding " ; " accodingly " ; " accomodate " ; " accomodates " ; " accompagnied " ; " accompagnies " ; " accompagny " ; " accompagnying " ; " accordint " ; " accoring " ; " accout " ; " accquire " ; " accquired " ; " accquires " ; " accquiring " ; " accross " ; " acessable " ; " acess " ; " achitecture " ; " achitectures " ; " achor " ; " achored " ; " achoring " ; " achors " ; " acient " ; " acknowldegement " ; " ackowledge " ; " ackowledged " ; " acording " ; " acordingly " ; " acqure " ; " acqured " ; " acqures " ; " acquring " ; " actaul " ; " actaully " ; " activete " ; " acually " ; " acumulating " ; " acutally " ; " adapated " ; " adapater " ; " adapaters " ; " addd " ; " addded " ; " addding " ; " addds " ; " addess " ; " addessed " ; " addesses " ; " addessing " ; " addional " ; " additionaly " ; " additonal " ; " additonally " ; " addres " ; " addresed " ; " addreses " ; " addresing " ; " addresss " ; " addresssed " ; " addressses " ; " addresssing " ; " aditional " ; " aditionally " ; " aditionaly " ; " adress " ; " adressed " ; " adresses " ; " adressing " ; " advertisment " ; " advertisments " ; " adviced " ; " afecting " ; " afer " ; " aforementionned " ; " aformentioned " ; " afterall " ; " agains " ; " agaist " ; " agressive " ; " agressively " ; " agrument " ; " agruments " ; " albumns " ; " alegorical " ; " algorith " ; " algorithmical " ; " algoritm " ; " algoritms " ; " algorrithm " ; " algorritm " ; " alignemnt " ; " alignemnts " ; " allign " ; " alligned " ; " alligning " ; " alligns " ; " allpication " ; " allthough " ; " alltogether " ; " allways " ; " alocate " ; " alocated " ; " alocates " ; " alocating " ; " alogirhtms " ; " alogrithm " ; " alogrithms " ; " alot " ; " alow " ; " alows " ; " alpabet " ; " alpabetical " ; " alpabetic " ; " alpabets " ; " alreay " ; " altough " ; " ambigious " ; " ambigous " ; " ammend " ; " ammended " ; " ammending " ; " ammends " ; " ammount " ; " amoung " ; " amout " ; " analagous " ; " analysator " ; " ang " ; " anniversery " ; " annoucement " ; " anomolies " ; " anomoly " ; " anway " ; " anyting " ; " aplication " ; " appearence " ; " appeneded " ; " appliction " ; " applictions " ; " appplication " ; " appplications " ; " appropiate " ; " appropriatly " ; " approproate " ; " appropropriate " ; " approriate " ; " approriately " ; " approximatly " ; " aproximation " ; " aproximations " ; " aqcuire " ; " aqcuired " ; " aqcuires " ; " aqcuiring " ; " aquaint " ; " aquainted " ; " aquainting " ; " aquaints " ; " aquire " ; " aquired " ; " aquisition " ; " arbitary " ; " arbitray " ; " archiecture " ; " archiectures " ; " architechture " ; " architechtures " ; " archvie " ; " archvies " ; " aready " ; " arent " ; " arguement " ; " arguements " ; " arithmatic " ; " aritmetic " ; " arne ' t " ; " aroung " ; " arraival " ; " arround " ; " artifical " ; " artifically " ; " artillary " ; " arugment " ; " arugments " ; " assertation " ; " assgin " ; " assgined " ; " assgining " ; " assginment " ; " assginments " ; " assgins " ; " assigment " ; " assigments " ; " assignement " ; " assignements " ; " assignemnt " ; " assignemnts " ; " assistent " ; " assocate " ; " assocated " ; " assocates " ; " assocating " ; " assocation " ; " associcate " ; " associcated " ; " associcates " ; " associcating " ; " assotiated " ; " asthetic " ; " asuming " ; " asycronous " ; " asynchonous " ; " asynchonously " ; " atomatically " ; " atomicly " ; " attachement " ; " attemps " ; " attemt " ; " attemted " ; " attemting " ; " attemtp " ; " attemtped " ; " attemtping " ; " attemtps " ; " attemts " ; " attibute " ; " attibutes " ; " attirbute " ; " attirbutes " ; " attruibutes " ; " atttribute " ; " atttributes " ; " autenticate " ; " autenticated " ; " autenticates " ; " autenticating " ; " autentication " ; " authenticaiton " ; " authentification " ; " authorative " ; " authoritive " ; " automaticall " ; " automaticaly " ; " automaticly " ; " automatize " ; " automatized " ; " automatizes " ; " autonymous " ; " auxilary " ; " auxillary " ; " auxilliary " ; " avaiable " ; " availabe " ; " availabled " ; " availablity " ; " availale " ; " availavility " ; " availble " ; " availiable " ; " avalable " ; " avaliable " ; " aviable " ; " avilable " ; " backgroud " ; " backslashs " ; " bahavior " ; " bakup " ; " bakups " ; " baloon " ; " baloons " ; " bandwith " ; " basicly " ; " batery " ; " beacause " ; " beacuse " ; " beause " ; " becasue " ; " becomming " ; " becuase " ; " beeing " ; " befor " ; " begining " ; " behavoir " ; " behavoirs " ; " bellow " ; " benifit " ; " betweeen " ; " betwen " ; " bianries " ; " bizzare " ; " blindy " ; " boundry " ; " brige " ; " briges " ; " brighness " ; " brokeness " ; " brower " ; " browers " ; " bufffer " ; " bufffers " ; " bulding " ; " bulid " ; " buliding " ; " bulids " ; " bulit " ; " bulletted " ; " calcualte " ; " calcualted " ; " calcualtes " ; " calcualting " ; " calender " ; " calulate " ; " calulated " ; " calulates " ; " calulating " ; " cancelation " ; " capabilies " ; " capabilites " ; " capatibilities " ; " captial " ; " carefuly " ; " cariage " ; " casue " ; " casued " ; " casues " ; " catagories " ; " catagory " ; " catched " ; " ceate " ; " ceated " ; " ceates " ; " ceating " ; " cehck " ; " cehcked " ; " cehcking " ; " cehcks " ; " certficate " ; " certficates " ; " certian " ; " certicate " ; " certicates " ; " certifcate " ; " certifcates " ; " challange " ; " challanges " ; " changable " ; " channle " ; " channles " ; " channnel " ; " channnels " ; " charachter " ; " charachters " ; " characted " ; " characteds " ; " charactor " ; " charactors " ; " charater " ; " charaters " ; " charcter " ; " chcek " ; " chceked " ; " chceking " ; " chceks " ; " checksuming " ; " childern " ; " childs " ; " chnage " ; " chnages " ; " choise " ; " choosen " ; " chracter " ; " chracters " ; " classs " ; " classses " ; " clearified " ; " clearifies " ; " clearify " ; " clearifying " ; " cleint " ; " cleints " ; " coefficent " ; " coefficents " ; " cofigure " ; " cofigured " ; " cofigures " ; " cofiguring " ; " collapsable " ; " collegue " ; " collegues " ; " colorfull " ; " comand " ; " coment " ; " comented " ; " comenting " ; " coments " ; " comit " ; " commad " ; " commads " ; " commerical " ; " comming " ; " comminucation " ; " commited " ; " commiter " ; " commiters " ; " commiting " ; " committ " ; " commmand " ; " commmands " ; " commment " ; " commmented " ; " commmenting " ; " commments " ; " commoditiy " ; " communcation " ; " compability " ; " comparision " ; " comparisions " ; " comparsion " ; " comparsions " ; " compatability " ; " compatabilty " ; " compatable " ; " compatbility " ; " compatiability " ; " compatibiliy " ; " compatibilty " ; " compatiblity " ; " competion " ; " competions " ; " compilant " ; " compleatly " ; " completly " ; " completness " ; " complient " ; " complier " ; " compliers " ; " complile " ; " compliled " ; " compliles " ; " compliling " ; " compling " ; " compontent " ; " compontents " ; " compres " ; " compresed " ; " compreses " ; " compresing " ; " compresion " ; " comptible " ; " comression " ; " comunication " ; " conatin " ; " conatined " ; " conatining " ; " conatins " ; " conbination " ; " conbinations " ; " concatentate " ; " concatentated " ; " concatentates " ; " concatentating " ; " concatentation " ; " concatentations " ; " concatination " ; " concatinations " ; " concensus " ; " conditionaly " ; " conditionnaly " ; " conection " ; " conections " ; " conent " ; " conents " ; " configuation " ; " configuations " ; " configuratoin " ; " conjuction " ; " conneciton " ; " connecitons " ; " connectinos " ; " connnect " ; " connnected " ; " connnecting " ; " connnection " ; " connnections " ; " connnects " ; " consistancy " ; " consistant " ; " consonent " ; " consonents " ; " constuctor " ; " constuctors " ; " containes " ; " containg " ; " containts " ; " contaisn " ; " contan " ; " contaned " ; " contaning " ; " contans " ; " contein " ; " conteined " ; " conteining " ; " conteins " ; " contence " ; " continous " ; " continously " ; " continueing " ; " contraints " ; " contries " ; " controled " ; " controler " ; " controlers " ; " controll " ; " controlls " ; " contruct " ; " contructed " ; " contructing " ; " contructor " ; " contructors " ; " contructs " ; " contry " ; " converstion " ; " converstions " ; " convertion " ; " convertions " ; " convertor " ; " convet " ; " conveted " ; " conveting " ; " convets " ; " convinient " ; " copyrigth " ; " copyrigthed " ; " copyrigths " ; " corected " ; " corespond " ; " coresponded " ; " corespondence " ; " coresponding " ; " coresponds " ; " correctnes " ; " correponding " ; " correponds " ; " correspoding " ; " correspondance " ; " correspondes " ; " corresponing " ; " corresponsing " ; " corretly " ; " coutner " ; " coutners " ; " coverted " ; " crtical " ; " cryptocraphic " ; " cummulative " ; " curently " ; " cymk " ; " dafault " ; " deafault " ; " deafult " ; " deamon " ; " debain " ; " debians " ; " debuging " ; " decalared " ; " decalare " ; " decalares " ; " decalaring " ; " decendant " ; " decendent " ; " declation " ; " declations " ; " decompres " ; " decompresed " ; " decompreses " ; " decompresing " ; " decribed " ; " decribe " ; " decribes " ; " decribing " ; " decription " ; " decriptions " ; " decriptor " ; " decriptors " ; " decsriptor " ; " decsriptors " ; " defalt " ; " defautl " ; " defered " ; " definate " ; " definately " ; " definining " ; " definitly " ; " defintion " ; " defintions " ; " defualt " ; " deivce " ; " deivces " ; " delared " ; " delare " ; " delares " ; " delaring " ; " delemiter " ; " delimeter " ; " delimeters " ; " demoninator " ; " demoninators " ; " demostrated " ; " demostrate " ; " demostrates " ; " demostrating " ; " depdencies " ; " depdency " ; " depencies " ; " depency " ; " dependancies " ; " dependancy " ; " dependant " ; " dependecies " ; " dependecy " ; " depenencies " ; " depenency " ; " depreacted " ; " depreacte " ; " deprectated " ; " deprectate " ; " deprectates " ; " deprectating " ; " deprected " ; " derefenced " ; " desactivate " ; " descibed " ; " descibe " ; " descibes " ; " descibing " ; " desciptor " ; " desciptors " ; " descriptior " ; " descriptiors " ; " descripton " ; " descriptons " ; " descrition " ; " descritpion " ; " descritpions " ; " desctiptor " ; " desctiptors " ; " desireable " ; " desriptor " ; " desriptors " ; " detabase " ; " detatch " ; " detatched " ; " detatches " ; " detatching " ; " detemined " ; " detemine " ; " detemines " ; " detemining " ; " determing " ; " determinstically " ; " determinstic " ; " detroy " ; " detroyed " ; " detroying " ; " detroys " ; " develoment " ; " develoments " ; " developement " ; " developped " ; " developpement " ; " developper " ; " developpment " ; " deveolpment " ; " devided " ; " diabled " ; " diable " ; " diables " ; " diabling " ; " dictionnary " ; " didnt " ; " didnt ' " ; " diferent " ; " differents " ; " differnet " ; " diffrent " ; " difinition " ; " difinitions " ; " digitial " ; " diplay " ; " directores " ; " directorys " ; " directries " ; " directry " ; " directy " ; " disapear " ; " disapeared " ; " disapearing " ; " disapears " ; " discernable " ; " disconnet " ; " disconneted " ; " disconneting " ; " disconnets " ; " discontinous " ; " discusion " ; " dispath " ; " dispathed " ; " dispathes " ; " dispathing " ; " dispertion " ; " dissapear " ; " dissapeared " ; " dissapearing " ; " dissapears " ; " distibuted " ; " distibute " ; " distibutes " ; " distibuting " ; " distibution " ; " distibutions " ; " distiction " ; " distingush " ; " distingushed " ; " distingushes " ; " distingushing " ; " distribtion " ; " distribtions " ; " divison " ; " divisons " ; " docuentation " ; " documantation " ; " documenation " ; " documentaion " ; " documention " ; " documetation " ; " doens ' t " ; " doesen ' t " ; " doesnt " ; " doesnt ' " ; " doesnt ' t " ; " does ' t " ; " doman " ; " domans " ; " dont " ; " dont ' " ; " dont ' t " ; " donwload " ; " donwloaded " ; " donwloading " ; " donwloads " ; " dosen ' t " ; " downlad " ; " downlads " ; " droppped " ; " dumplicated " ; " dumplicate " ; " dumplicates " ; " dumplicating " ; " dupliate " ; " dupliates " ; " easilly " ; " ecspecially " ; " edditable " ; " editting " ; " effectly " ; " efficency " ; " efficent " ; " efficently " ; " egde " ; " egdes " ; " eletronic " ; " eligable " ; " elliminated " ; " elliminate " ; " elliminates " ; " elliminating " ; " elment " ; " elments " ; " elminated " ; " elminate " ; " elminates " ; " elminating " ; " embeddeding " ; " embeded " ; " emptry " ; " emtpy " ; " enchanced " ; " enconding " ; " encondings " ; " encorporating " ; " encosed " ; " encose " ; " encoses " ; " encosing " ; " encrytion " ; " endianes " ; " endianess " ; " endiannes " ; " enhaced " ; " enhancment " ; " enhancments " ; " enitities " ; " enitity " ; " enlightnment " ; " enocded " ; " enrties " ; " enrty " ; " enterily " ; " entites " ; " envionment " ; " envireonment " ; " enviroiment " ; " enviromental " ; " enviromentally " ; " enviroment " ; " enviroments " ; " environement " ; " environent " ; " eqivalent " ; " equiped " ; " equivelant " ; " equivilant " ; " equvalent " ; " eroneous " ; " eror " ; " erorr " ; " erorrs " ; " erors " ; " erroneus " ; " erroneusly " ; " erronous " ; " erronously " ; " errorneous " ; " errorneously " ; " errror " ; " errrors " ; " esential " ; " esentially " ; " estbalishment " ; " etsablishment " ; " etsbalishment " ; " evalutated " ; " evalutate " ; " evalutates " ; " evalutating " ; " evaluted " ; " evalute " ; " evalutes " ; " evaluting " ; " eventhough " ; " everbody " ; " everone " ; " everthing " ; " everwhere " ; " everyhing " ; " everythings " ; " evironment " ; " evironments " ; " excact " ; " excactly " ; " excecutable " ; " exceded " ; " excellant " ; " excercised " ; " excercise " ; " excercises " ; " excercising " ; " excpected " ; " excpect " ; " excpecting " ; " excpects " ; " excutable " ; " excutables " ; " excuted " ; " excute " ; " excutes " ; " excuting " ; " exeception " ; " execeptions " ; " exectuable " ; " exectuables " ; " executeable " ; " executeables " ; " exension " ; " exensions " ; " exept " ; " exeption " ; " exeptions " ; " exising " ; " exisiting " ; " existance " ; " existant " ; " exlcude " ; " exlcusive " ; " exlicit " ; " exlicitly " ; " exmaple " ; " expecially " ; " expectes " ; " explaination " ; " explainations " ; " explantion " ; " explantions " ; " explicitely " ; " explicitily " ; " explicity " ; " explict " ; " explictly " ; " explit " ; " explitly " ; " expresion " ; " expresions " ; " expresssion " ; " expresssions " ; " exprimental " ; " extensability " ; " extenstion " ; " extenstions " ; " extented " ; " extention " ; " extesion " ; " extesions " ; " extracter " ; " extraenous " ; " faciliated " ; " faciliate " ; " faciliates " ; " faciliating " ; " faild " ; " failue " ; " failuer " ; " failues " ; " falg " ; " falgs " ; " faliure " ; " faliures " ; " familar " ; " fatser " ; " feasable " ; " feauture " ; " feautures " ; " fetaure " ; " fetaures " ; " ficticious " ; " filesytem " ; " filesytems " ; " fileystem " ; " fileystems " ; " findout " ; " finsihed " ; " finsihes " ; " finsih " ; " finsihing " ; " fitler " ; " fitlers " ; " flie " ; " floting " ; " flusing " ; " foget " ; " fogot " ; " fogotten " ; " folloing " ; " follwing " ; " follwoing " ; " folowing " ; " forbiden " ; " foreing " ; " forground " ; " formated " ; " formating " ; " forseeable " ; " forse " ; " fortan " ; " forunate " ; " forunately " ; " forwaded " ; " forwad " ; " forwading " ; " forwads " ; " forwardig " ; " fowarded " ; " foward " ; " fowarding " ; " fowards " ; " framwork " ; " freqencies " ; " freqency " ; " frontent " ; " frontents " ; " fucntion " ; " fucntions " ; " fuction " ; " fuctions " ; " fullfill " ; " funcion " ; " funcions " ; " funciton " ; " funcitons " ; " functionallity " ; " functionaly " ; " functionnality " ; " functiosn " ; " functonality " ; " funtion " ; " funtions " ; " futher " ; " futhermore " ; " gauranteed " ; " gaurantee " ; " gauranteeing " ; " gaurantees " ; " generater " ; " generaters " ; " genereated " ; " genereate " ; " genereates " ; " genereating " ; " generiously " ; " genrated " ; " genrate " ; " genrates " ; " genrating " ; " genreated " ; " genreate " ; " genreates " ; " genreating " ; " genric " ; " geomtry " ; " geting " ; " glpyh " ; " glpyhs " ; " goverment " ; " grabing " ; " grahical " ; " grahpical " ; " gramatically " ; " grammer " ; " grammers " ; " grapic " ; " guage " ; " guarenteed " ; " guarentee " ; " guarenteeing " ; " guarentees " ; " guassian " ; " halfs " ; " hander " ; " handfull " ; " hanshake " ; " hanshakes " ; " hapening " ; " happend " ; " happenned " ; " harcoded " ; " harcode " ; " harcodes " ; " harcoding " ; " harware " ; " havent " ; " heigth " ; " heirarchical " ; " heirarchically " ; " heirarchies " ; " heirarchy " ; " helpfull " ; " hexidecimal " ; " hiearchies " ; " hiearchy " ; " hierachical " ; " hierachies " ; " hierachy " ; " hierarchie " ; " higer " ; " highlighing " ; " highlightning " ; " higlighted " ; " higlight " ; " higlighting " ; " higlights " ; " hilighted " ; " hilight " ; " hilighting " ; " hilights " ; " horzontal " ; " horzontally " ; " howerver " ; " howver " ; " hypenated " ; " hypenate " ; " hypenates " ; " hypenating " ; " hypenation " ; " hypen " ; " hypens " ; " identifer " ; " identifers " ; " idicated " ; " idicate " ; " idicates " ; " idicating " ; " igored " ; " igore " ; " igores " ; " igoring " ; " imediate " ; " imediately " ; " immeadiately " ; " immedate " ; " immedately " ; " immediatelly " ; " immediatly " ; " immidiate " ; " immmediate " ; " immmediately " ; " impementation " ; " impementations " ; " implemantation " ; " implemementation " ; " implemementations " ; " implememented " ; " implemement " ; " implemementing " ; " implemements " ; " implemenation " ; " implemenations " ; " implementaion " ; " implementaions " ; " implementated " ; " implemention " ; " implemetation " ; " implemeted " ; " implemet " ; " implemeting " ; " implemets " ; " implemntation " ; " implemntations " ; " implicitely " ; " implicity " ; " implmentation " ; " implmented " ; " implment " ; " implmenting " ; " implments " ; " improvment " ; " improvments " ; " inadvertant " ; " inadvertantly " ; " inclued " ; " inclue " ; " inclues " ; " incluing " ; " incomming " ; " incompatabilities " ; " incompatability " ; " incompatable " ; " incompatbility " ; " incompatiability " ; " incomptible " ; " inconsistant " ; " incoporated " ; " incoporate " ; " incoporates " ; " incoporating " ; " increas " ; " incuded " ; " incude " ; " incudes " ; " incuding " ; " incure " ; " indeces " ; " indempotent " ; " indendation " ; " indended " ; " indentical " ; " indentified " ; " indentifies " ; " indentify " ; " indentifying " ; " independant " ; " independed " ; " indepenent " ; " indepenently " ; " indiated " ; " indiate " ; " indiates " ; " indiating " ; " indiciated " ; " indiciate " ; " indiciates " ; " indiciating " ; " indipendent " ; " indipendently " ; " indivudual " ; " indivudually " ; " inefficency " ; " inferrence " ; " infomation " ; " informatiom " ; " informations " ; " infromation " ; " ingored " ; " ingore " ; " ingores " ; " ingoring " ; " inheritence " ; " inital " ; " initalisation " ; " initalised " ; " initalise " ; " initalises " ; " initalising " ; " initalization " ; " initalized " ; " initalize " ; " initalizes " ; " initalizing " ; " initators " ; " initializiation " ; " initialsed " ; " initialse " ; " initialses " ; " initialzed " ; " initialze " ; " initialzes " ; " initiliased " ; " initiliase " ; " initiliases " ; " initiliasing " ; " initiliazed " ; " initiliaze " ; " initiliazes " ; " initiliazing " ; " initilized " ; " initilize " ; " initilizes " ; " initilizing " ; " inlcuded " ; " inlcude " ; " inlcudes " ; " inlcuding " ; " inofficial " ; " inproper " ; " inproperly " ; " insensistive " ; " insensistively " ; " instanciated " ; " instanciate " ; " instanciates " ; " instanciating " ; " instanciation " ; " instanciations " ; " intance " ; " intances " ; " intead " ; " inteface " ; " integreated " ; " integrety " ; " integrey " ; " intendet " ; " intentially " ; " intepreted " ; " intepreter " ; " intepreters " ; " intepreting " ; " intepret " ; " inteprets " ; " interace " ; " interaces " ; " interator " ; " interators " ; " interchangable " ; " interchangably " ; " interesected " ; " interesecting " ; " interesect " ; " interesection " ; " interesections " ; " interesects " ; " interferred " ; " interferring " ; " interger " ; " intergers " ; " intermittant " ; " internel " ; " internels " ; " interpeted " ; " interpeter " ; " interpeters " ; " interpeting " ; " interpet " ; " interpets " ; " interpretes " ; " interruped " ; " interupted " ; " interupting " ; " interupt " ; " interupts " ; " intial " ; " intialisation " ; " intialised " ; " intialise " ; " intialises " ; " intialising " ; " intialization " ; " intialized " ; " intialize " ; " intializes " ; " intializing " ; " intially " ; " intregral " ; " intrrupted " ; " intrrupting " ; " intrrupt " ; " intrrupts " ; " intruction " ; " intructions " ; " intrumented " ; " intrumenting " ; " intrument " ; " intruments " ; " intuative " ; " invaid " ; " invalud " ; " invarient " ; " invididual " ; " invokation " ; " invokations " ; " irrelevent " ; " isnt " ; " istead " ; " itialized " ; " itialize " ; " itializes " ; " itializing " ; " itslef " ; " jave " ; " keywork " ; " langage " ; " langauage " ; " langauge " ; " langauges " ; " langugage " ; " languge " ; " languges " ; " laoded " ; " laoding " ; " laod " ; " laods " ; " lauched " ; " laucher " ; " lauches " ; " lauching " ; " lauch " ; " leightweight " ; " lengh " ; " lenghs " ; " lenght " ; " lenghts " ; " lenghty " ; " lengthes " ; " lenth " ; " lesstiff " ; " libaries " ; " libary " ; " librairies " ; " libraris " ; " licenceing " ; " licese " ; " ligth " ; " likelyhood " ; " limted " ; " lintain " ; " loggging " ; " loggin " ; " logile " ; " longers " ; " loosly " ; " machinary " ; " maintainance " ; " maintainence " ; " maintaing " ; " maintance " ; " maintan " ; " makeing " ; " malplaced " ; " malplace " ; " mamory " ; " managable " ; " managment " ; " manoeuvering " ; " mantained " ; " mantainer " ; " mantaining " ; " mantain " ; " mantains " ; " manully " ; " matchin " ; " matcing " ; " mathimatical " ; " mathimatic " ; " mathimatics " ; " maxium " ; " mecanism " ; " mecanisms " ; " mechamism " ; " mechamisms " ; " mentiond " ; " mentionned " ; " ment " ; " mesage " ; " mesages " ; " messags " ; " messge " ; " messges " ; " messsage " ; " messsages " ; " microprocesspr " ; " milisecond " ; " miliseconds " ; " millenium " ; " milliseonds " ; " mimicing " ; " mimick " ; " mimicks " ; " mininum " ; " miniscule " ; " minumum " ; " miscelleneous " ; " misformed " ; " mismached " ; " mismaches " ; " mismaching " ; " mismach " ; " mispelled " ; " mispelt " ; " missconfiguration " ; " missconfigured " ; " missconfigure " ; " missconfigures " ; " missconfiguring " ; " missmatched " ; " missmatches " ; " missmatching " ; " missmatch " ; " mmnemonic " ; " modfied " ; " modfies " ; " modfying " ; " modfy " ; " modifed " ; " modifing " ; " modulues " ; " monochorome " ; " monochromo " ; " monocrome " ; " morever " ; " mroe " ; " mulitple " ; " mulitplied " ; " multidimensionnal " ; " multipled " ; " multple " ; " multplied " ; " multplies " ; " multplying " ; " multply " ; " mumber " ; " mumbers " ; " musn ' t " ; " mutiple " ; " mutliple " ; " nam " ; " nams " ; " navagating " ; " nead " ; " neccecary " ; " neccesarily " ; " neccesary " ; " neccessarily " ; " neccessary " ; " necesarily " ; " necesarrily " ; " necesarry " ; " necesary " ; " necessar " ; " nedded " ; " neeeded " ; " neeeding " ; " neeed " ; " neeeds " ; " negotation " ; " nescessary " ; " nesesarily " ; " nessesary " ; " nessessary " ; " nonexistant " ; " nontheless " ; " noone " ; " normaly " ; " noticable " ; " noticably " ; " notications " ; " notifcation " ; " notifcations " ; " notifed " ; " nubmer " ; " nubmers " ; " numberal " ; " numberals " ; " numebr " ; " numebrs " ; " numner " ; " numners " ; " observered " ; " obsure " ; " o ' caml " ; " occassionally " ; " occationally " ; " occurance " ; " occurances " ; " occured " ; " occurence " ; " occurences " ; " occuring " ; " occurrance " ; " occurrances " ; " ocurrence " ; " ocurrences " ; " offical " ; " officialy " ; " ofthe " ; " omitt " ; " ommiting " ; " ommitted " ; " onself " ; " opague " ; " openened " ; " openned " ; " openning " ; " opertaion " ; " opertaions " ; " opion " ; " opions " ; " optinally " ; " optinal " ; " optionaly " ; " optionnal " ; " optmization " ; " optmizations " ; " orderd " ; " orginally " ; " orginal " ; " orgin " ; " orientatied " ; " orientied " ; " origionally " ; " origional " ; " orignal " ; " otehr " ; " otherwhise " ; " othwerwise " ; " ouptut " ; " ouput " ; " ouputs " ; " ouputted " ; " ouputting " ; " outputing " ; " outut " ; " overaall " ; " overidden " ; " overide " ; " overides " ; " overiding " ; " overlaped " ; " overlaping " ; " overridded " ; " overrided " ; " overriden " ; " overrridden " ; " overrriden " ; " overrride " ; " overrriding " ; " overun " ; " overwite " ; " overwites " ; " overwitten " ; " ovverridden " ; " ovverride " ; " ovverrides " ; " ovverriding " ; " owership " ; " pacakge " ; " pachage " ; " pach " ; " packacge " ; " packege " ; " packge " ; " packges " ; " pakage " ; " palete " ; " pallete " ; " pallette " ; " paniced " ; " panicing " ; " paralellism " ; " paralell " ; " paralel " ; " parallell " ; " parallization " ; " parallized " ; " parallize " ; " parallizes " ; " parallizing " ; " paramameters " ; " paramater " ; " parametes " ; " parametised " ; " paramter " ; " paramters " ; " parantheses " ; " paranthesis " ; " paremeter " ; " paremeters " ; " parenthesed " ; " particularily " ; " partioning " ; " pased " ; " pathes " ; " pecularities " ; " pecularity " ; " peformance " ; " peice " ; " peices " ; " penalities " ; " penality " ; " pendantic " ; " peprocessor " ; " perfomed " ; " perfoming " ; " perfom " ; " perfoms " ; " perfromance " ; " perfromed " ; " perfroming " ; " perfrom " ; " perfroms " ; " peristent " ; " permanantly " ; " permanant " ; " permision " ; " permisions " ; " permissons " ; " permuation " ; " permuations " ; " peroid " ; " peroids " ; " persistance " ; " persistant " ; " personnal " ; " perviously " ; " pervious " ; " pitty " ; " plase " ; " platfrom " ; " platfroms " ; " plattform " ; " pleaes " ; " ploting " ; " poinnter " ; " poiter " ; " poiters " ; " poluted " ; " polute " ; " polutes " ; " poluting " ; " polution " ; " portugese " ; " posible " ; " positionned " ; " positon " ; " positons " ; " positve " ; " positves " ; " possesion " ; " possibe " ; " possibilites " ; " possibilties " ; " possibilty " ; " possiblities " ; " possiblity " ; " postgressql " ; " postion " ; " postions " ; " postive " ; " postives " ; " powerfull " ; " prcesses " ; " prcess " ; " preceeded " ; " preceeding " ; " preceed " ; " preceeds " ; " precendence " ; " precison " ; " precission " ; " prefered " ; " preferrable " ; " preferrably " ; " prefferable " ; " prefferably " ; " prepaired " ; " prepartion " ; " prepartions " ; " prerequsite " ; " prerequsites " ; " prevously " ; " priciple " ; " priciples " ; " primative " ; " princliple " ; " priorty " ; " priveleged " ; " privilaged " ; " privilage " ; " privilages " ; " priviledge " ; " priviledges " ; " privilige " ; " priviliges " ; " probaly " ; " problably " ; " procceed " ; " proccesors " ; " proccesses " ; " proccess " ; " proceded " ; " procede " ; " procedes " ; " proceding " ; " proceeeded " ; " proceeeding " ; " proceeed " ; " proceeeds " ; " procesed " ; " proceses " ; " proces " ; " processessing " ; " processess " ; " processpr " ; " processsed " ; " processses " ; " processsing " ; " processs " ; " proctected " ; " proctecting " ; " proctect " ; " proctects " ; " procude " ; " progams " ; " progess " ; " programers " ; " programm " ; " programms " ; " promiscous " ; " promps " ; " pronnounced " ; " prononciation " ; " pronouce " ; " pronunce " ; " propery " ; " propigate " ; " propigation " ; " propogated " ; " propogate " ; " propogates " ; " propogating " ; " prosess " ; " protable " ; " protcol " ; " protecion " ; " protocoll " ; " psuedo " ; " psychadelic " ; " qouted " ; " qoute " ; " qoutes " ; " qouting " ; " queing " ; " quering " ; " reachs " ; " readabilty " ; " reasearcher " ; " reasearchers " ; " reasearch " ; " reasonble " ; " reasonbly " ; " rebuliding " ; " rebulid " ; " rebulids " ; " rebulit " ; " reccommended " ; " reccommending " ; " reccommend " ; " reccommends " ; " receieved " ; " receieve " ; " receieves " ; " receieving " ; " recepient " ; " recepients " ; " receved " ; " receve " ; " receves " ; " receving " ; " recieved " ; " recieve " ; " reciever " ; " recieves " ; " recieving " ; " recipies " ; " recogized " ; " recogize " ; " recogizes " ; " recogizing " ; " recogniced " ; " recognizeable " ; " recommanded " ; " rectange " ; " rectanges " ; " recurrance " ; " recyled " ; " recyle " ; " recyles " ; " recyling " ; " redefintion " ; " redefintions " ; " redircet " ; " redirectrion " ; " reenabled " ; " reenable " ; " reencode " ; " refected " ; " refecting " ; " refect " ; " refects " ; " refence " ; " refered " ; " refernced " ; " refernce " ; " refernces " ; " referncing " ; " refrenced " ; " refrence " ; " refrences " ; " refrencing " ; " regaring " ; " registed " ; " registeing " ; " registerd " ; " registe " ; " registes " ; " registraration " ; " regulamentations " ; " regularily " ; " reimplmentation " ; " reimplmented " ; " reimplmenting " ; " reimplment " ; " reimplments " ; " releasse " ; " releated " ; " reletively " ; " reletive " ; " relevent " ; " remaing " ; " remoote " ; " removeable " ; " renderering " ; " renegotation " ; " repaced " ; " repace " ; " repaces " ; " repacing " ; " repeatly " ; " repectively " ; " repective " ; " replacable " ; " replacments " ; " replys " ; " reponse " ; " reponses " ; " representaion " ; " representaions " ; " represneted " ; " represneting " ; " represnet " ; " represnets " ; " reproducable " ; " requiered " ; " requiere " ; " requieres " ; " requiering " ; " requred " ; " requrested " ; " requresting " ; " requrest " ; " requrests " ; " requried " ; " requsted " ; " requsting " ; " requst " ; " requsts " ; " resemblence " ; " reserverd " ; " reseted " ; " reseting " ; " resetted " ; " resizeable " ; " resouce " ; " resouces " ; " resoure " ; " resoures " ; " responce " ; " responces " ; " responsabilities " ; " responsability " ; " responsed " ; " responsiblity " ; " responsing " ; " ressize " ; " ressource " ; " ressources " ; " ressurected " ; " ressurecting " ; " ressurect " ; " ressurects " ; " resursively " ; " resursive " ; " retored " ; " retore " ; " retores " ; " retoring " ; " retransmited " ; " retreived " ; " retreive " ; " retrived " ; " retrive " ; " retrives " ; " retriving " ; " retuns " ; " retured " ; " returing " ; " returnd " ; " returnes " ; " retur " ; " returs " ; " reuest " ; " reuests " ; " reuqested " ; " reuqesting " ; " reuqest " ; " reuqests " ; " rewriten " ; " rigth " ; " rigths " ; " rmeoved " ; " rmeove " ; " rmeoves " ; " rougly " ; " rountine " ; " rountines " ; " rquested " ; " rquesting " ; " rquest " ; " rquests " ; " runing " ; " runned " ; " runnning " ; " sacrifying " ; " safly " ; " saftey " ; " safty " ; " santized " ; " santize " ; " santizes " ; " santizing " ; " satisfiabilty " ; " satisified " ; " satisifies " ; " satisifying " ; " satisify " ; " savable " ; " savely " ; " savety " ; " scaned " ; " scaning " ; " seached " ; " seaches " ; " seaching " ; " seach " ; " searchs " ; " secund " ; " securty " ; " sematically " ; " sematical " ; " sematic " ; " sematics " ; " sempahore " ; " sempahores " ; " sensistive " ; " sensistively " ; " sentance " ; " sentances " ; " sentinal " ; " sentinals " ; " separatly " ; " separed " ; " separted " ; " separte " ; " separtes " ; " separting " ; " sepcified " ; " sepcifies " ; " sepcifying " ; " sepcify " ; " seperated " ; " seperately " ; " seperate " ; " seperates " ; " seperating " ; " seperatly " ; " seperator " ; " sepperate " ; " seprator " ; " seprators " ; " sequece " ; " sequeces " ; " sequencial " ; " serie " ; " serivce " ; " serivces " ; " serveral " ; " sesssion " ; " sesssions " ; " setts " ; " settting " ; " setttings " ; " shoud " ; " shouldnt " ; " shoule " ; " siginificantly " ; " siginificant " ; " signficantly " ; " signficant " ; " signle " ; " similarily " ; " similary " ; " similiarly " ; " similiar " ; " simlarlity " ; " simlarly " ; " simlar " ; " simliar " ; " simmilar " ; " simplier " ; " simultanously " ; " simultanous " ; " singal " ; " singed " ; " sitation " ; " sitations " ; " skiped " ; " skiping " ; " slashs " ; " sligthly " ; " sligth " ; " smae " ; " softwares " ; " sofware " ; " somehwere " ; " somes " ; " someting " ; " somthing " ; " souce " ; " souces " ; " spawed " ; " spawing " ; " spaw " ; " spaws " ; " speach " ; " spearator " ; " spearators " ; " specfication " ; " specfications " ; " specfic " ; " specfied " ; " specfies " ; " specfying " ; " specfy " ; " speciefied " ; " specifc " ; " specifed " ; " specificatin " ; " specificaton " ; " specifing " ; " specifiying " ; " specifiy " ; " speficied " ; " spefic " ; " speling " ; " splitted " ; " spported " ; " spporting " ; " spports " ; " spport " ; " spreaded " ; " spurios " ; " sructures " ; " sructure " ; " staically " ; " standardss " ; " standart " ; " staticly " ; " statments " ; " statment " ; " stirngs " ; " stirng " ; " stoped " ; " stoping " ; " stoppped " ; " straigth " ; " straigt " ; " strenghts " ; " strenght " ; " strenth " ; " stucts " ; " stuct " ; " stuctures " ; " stucture " ; " sturctures " ; " sturcture " ; " subdirectoires " ; " subexpresssions " ; " subexpresssion " ; " suble " ; " subseqent " ; " subsequest " ; " substituions " ; " substituion " ; " substracted " ; " substracting " ; " substraction " ; " substracts " ; " substract " ; " subtituted " ; " subtitutes " ; " subtitute " ; " subtituting " ; " subtitutions " ; " subtitution " ; " succeded " ; " succedes " ; " succede " ; " succeding " ; " succeedes " ; " succesfully " ; " succesful " ; " succesive " ; " successfull " ; " successfuly " ; " succint " ; " suceeded " ; " suceeding " ; " suceeds " ; " suceed " ; " sucesses " ; " sucessfully " ; " sucess " ; " sufficently " ; " sufficent " ; " superflous " ; " superseeded " ; " suplied " ; " suported " ; " suporting " ; " suports " ; " suport " ; " suppied " ; " suppies " ; " suppored " ; " supportin " ; " suppoted " ; " suppported " ; " suppporting " ; " suppports " ; " suppport " ; " suppying " ; " suppy " ; " supressed " ; " supresses " ; " supressing " ; " supress " ; " surpressed " ; " surpresses " ; " surpressing " ; " surpress " ; " suspicously " ; " suspicous " ; " sustitutions " ; " sustitution " ; " suuported " ; " suuporting " ; " suuports " ; " suuport " ; " swaping " ; " symetric " ; " synax " ; " synchonized " ; " synchonizes " ; " syncronize " ; " syncronizing " ; " syncronus " ; " synopsys " ; " syste " ; " sytems " ; " sytem " ; " sythesis " ; " taht " ; " targetted " ; " targetting " ; " teached " ; " teh " ; " temorary " ; " terminaters " ; " terminater " ; " thats " ; " theer " ; " theres " ; " therfore " ; " thier " ; " thie " ; " threasholds " ; " threashold " ; " threhold " ; " threshholds " ; " threshhold " ; " throught " ; " thses " ; " thsi " ; " tiggered " ; " tiggering " ; " tiggers " ; " tigger " ; " tigthened " ; " tigthening " ; " tigthens " ; " tigthen " ; " tigth " ; " tihs " ; " timetamps " ; " timetamp " ; " timout " ; " togther " ; " touple " ; " traditionnal " ; " trailling " ; " tranfered " ; " tranfering " ; " tranfers " ; " tranfer " ; " tranformations " ; " tranformation " ; " tranformed " ; " tranforming " ; " tranforms " ; " tranform " ; " tranlations " ; " tranlation " ; " tranparently " ; " tranparent " ; " transfered " ; " transfering " ; " transistions " ; " transistion " ; " transitionned " ; " transmition " ; " transormed " ; " transorming " ; " transorms " ; " transorm " ; " transtions " ; " transtion " ; " transtitions " ; " transtition " ; " trasmission " ; " treshold " ; " trigerring " ; " truely " ; " tupples " ; " tupple " ; " typicaly " ; " typles " ; " typle " ; " uesd " ; " uknown " ; " uncomented " ; " uncomenting " ; " uncoments " ; " uncoment " ; " uncommmented " ; " uncommmenting " ; " uncommments " ; " uncommment " ; " uncomplete " ; " unconditionaly " ; " uncoverted " ; " underuns " ; " underun " ; " undesireable " ; " unecessary " ; " uneeded " ; " unexcpected " ; " unexecpted " ; " unexected " ; " unexepcted " ; " unfortunatelly " ; " unfortunatly " ; " unforunately " ; " unforunate " ; " uninitalized " ; " unintentially " ; " uniqe " ; " unitialized " ; " univerities " ; " univerity " ; " unknonw " ; " unknow " ; " unkown " ; " unles " ; " unneccesarily " ; " unneccesary " ; " unneccessarily " ; " unneccessary " ; " unnecesarily " ; " unnecesary " ; " unnedded " ; " unneedingly " ; " unnesesarily " ; " unnessecary " ; " unnessesary " ; " unoffical " ; " unorderd " ; " unqouted " ; " unqoutes " ; " unqoute " ; " unqouting " ; " unrecogized " ; " unreconized " ; " unsinged " ; " unspported " ; " unsual " ; " unsued " ; " unsuported " ; " untill " ; " unusally " ; " unusal " ; " unuseful " ; " unusuable " ; " unversionned " ; " unversoned " ; " upated " ; " upates " ; " upate " ; " upating " ; " updateing " ; " upsream " ; " upsteam " ; " upstrema " ; " upto " ; " usally " ; " usal " ; " usefule " ; " usefull " ; " usege " ; " usera " ; " userful " ; " usetnet " ; " usuable " ; " usualy " ; " utilites " ; " utillities " ; " utilties " ; " utiltity " ; " utitlty " ; " utlity " ; " vaiables " ; " vaiable " ; " vaild " ; " validing " ; " varables " ; " varable " ; " variabes " ; " variabe " ; " variantions " ; " varibales " ; " varibale " ; " varient " ; " varity " ; " vauled " ; " vaules " ; " vaule " ; " vauling " ; " verbse " ; " verions " ; " verion " ; " verious " ; " verisons " ; " verison " ; " veritical " ; " verry " ; " versionned " ; " versionning " ; " versoned " ; " versons " ; " verson " ; " vicefersa " ; " visiters " ; " vitual " ; " wan ' t " ; " wasnt " ; " weigth " ; " weired " ; " werent " ; " wether " ; " whataver " ; " whenver " ; " wheras " ; " wheter " ; " whish " ; " whithout " ; " wich " ; " widht " ; " wierd " ; " wihout " ; " wiht " ; " wiil " ; " wilcards " ; " wilcard " ; " withing " ; " witin " ; " wnated " ; " wnating " ; " wnats " ; " wnat " ; " wont " ; " workaroung " ; " writeing " ; " writen " ; " writting " ; " xwindows " ; " yeilded " ; " yeilding " ; " yeilds " ; " yeild " ; " yur " ] |
let regexp = let make_regexp word = " \\ b " ^ Str . quote word ^ " \\ b " in Str . regexp @@ String . concat " " \\| @@ List . map make_regexp badwords |
let string_search re s start = try ignore ( Str . search_forward re s start ) ; true with Not_found -> false |
let find s = if string_search regexp s 0 then Some ( Str . matched_string s ) else None |
module Seq = struct include Seq let of_list l = let rec aux l ( ) = match l with | [ ] -> Seq . Nil | x :: tail -> Seq . Cons ( x , aux tail ) in aux l let to_rev_list gen = fold_left ( fun acc x -> x :: acc ) [ ] gen let to_list gen = List . rev ( to_rev_list gen ) end |
let map_3 f ( x , y , z ) = ( x , y , f z ) |
module T = struct type ( ' a , ' b ) conv = { to_ : ' a -> ' b ; from_ : ' b -> ' a ; } type ' a raw = | Regexp : Re . t * Re . re Lazy . t -> string raw | Conv : ' a raw * ( ' a , ' b ) conv -> ' b raw | Opt : ' a raw -> ( ' a option ) raw | Alt : ' a raw * ' b raw -> [ ` Left of ' a | ` Right of ' b ] raw | Seq : ' a raw * ' b raw -> ( ' a * ' b ) raw | Prefix : ' b raw * ' a raw -> ' a raw | Suffix : ' a raw * ' b raw -> ' a raw | Rep : ' a raw -> ' a Seq . t raw | Mod : ( Re . t -> Re . t ) * ' a raw -> ' a raw type _ wit = | Lit : int -> string wit | Conv : ' a wit * ( ' a , ' b ) conv -> ' b wit | Opt : Re . Mark . t * ' a wit -> ' a option wit | Alt : Re . Mark . t * ' a wit * ' b wit -> [ ` Left of ' a | ` Right of ' b ] wit | Seq : ' a wit * ' b wit -> ( ' a * ' b ) wit | Rep : int * ' a wit * Re . re -> ' a Seq . t wit end |
type ' a t = ' a T . raw |
let regex x : _ t = let re = lazy Re . ( compile @@ whole_string @@ no_group x ) in Regexp ( x , re ) |
let pcre s = regex @@ Re . Pcre . re s |
let conv to_ from_ x : _ t = Conv ( x , { to_ ; from_ } ) |
let seq a b : _ t = Seq ( a , b ) |
let alt a b : _ t = Alt ( a , b ) |
let prefix x a : _ t = Prefix ( x , a ) |
let suffix a x : _ t = Suffix ( a , x ) |
let opt a : _ t = Opt a |
module Infix = struct let ( ) <|> = alt let ( ) <&> = seq let ( ) *> = prefix let ( <* ) = suffix end |
let rep x : _ t = Rep x |
let rep1 x = x <&> rep x |
let modifier f re : _ t = Mod ( f , re ) |
let word re = modifier Re . word re |
let whole_string re = modifier Re . whole_string re |
let longest re = modifier Re . longest re |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.