Ft_turing.Langtype transition = string * string * directionType for transitions to_state:string * write:string * direction: Left | Right
val from_direction : direction -> stringfrom_direction action Function is used for printing and conversion of type direction to string
val to_direction : string -> directionto_direction action Function is used in parsing to encode action fields in transitions definitions
to_string field json extracts string date from field in a Yojson.Basic.t object json. Calls Utils.err_invalid_type if type is incorrect
to_string_option field json extracts string list data from field in a Yojson.Basic.t object json. Calls Utils.err_invalid_type if type is incorrect
to_assoc_knv_list field json extracts a (string * Yojson.Basic.t) list from field that is contained in the json object. Calls Utils.err_invalid_type if type is incorrect
val get_transitions :
Yojson.Basic.t ->
(string * (string * string * direction)) listget_transitions v returns a (read:string * (to_state:string * write:read * action:direction)) list found in Yojson.Basic.t object v. Calls Utils.err_invalid_type if type is incorrect
val to_transition_table :
string list ->
(string * Yojson.Basic.t) list ->
( string * string, transition ) Stdlib.Hashtbl.tto_transition_table alphabet states transitions returns a (state:string * read:string) (to_state:string * write:read * action:direction) Hashtbl.t. This function also runs several kinds of sanity checks on the validity of transitions described in the json file
val to_transitions_tbl :
string list ->
string ->
Yojson.Basic.t ->
( string * string, transition ) Stdlib.Hashtbl.tto_transitions_tbl alphabet states field json converts the value contained in field in the json object to (string * Yojson.Basic.t) list and feeds to the function handling the conversion to a type Hashtbl.t
val to_states_tbl :
Stdlib.String.t ->
Stdlib.String.t list ->
Stdlib.String.t list ->
( Stdlib.String.t, bool * bool ) Stdlib.Hashtbl.tto_states_tbl initial finals states takes a string list of states, and converts it to a string (is_initial:bool * is_final:bool) Hashtbl and calls Utils.error if a given state appears several times in the "states" field in the json file
get_value_and_check errmsg v check simple generic function that takes an error message to feed to Utils.error if needed, a value v and a check function of type (v:string -> bool)
convert_json jsonfile takes jsonfile and converts it to a Yojson.Basic.t json object
val to_machine :
string ->
Stdlib.String.t
* string list
* string
* ( Stdlib.String.t, bool * bool ) Stdlib.Hashtbl.t
* string
* string list
* ( string * string, transition ) Stdlib.Hashtbl.tto_machnine jsonfile function parses the jsonfile and does all necessary sanity checks and conversions for the interpreter