61 lines
1.2 KiB
OCaml
61 lines
1.2 KiB
OCaml
type a_exp =
|
|
Aval of int
|
|
| Plus of a_exp * a_exp
|
|
| Minus of a_exp * a_exp
|
|
| Times of a_exp * a_exp
|
|
| Of_bool of b_exp
|
|
and b_exp =
|
|
Bval of bool
|
|
| And of b_exp * b_exp
|
|
| Or of b_exp * b_exp
|
|
| Not of b_exp
|
|
| Minor of a_exp * a_exp
|
|
|
|
|
|
val eval_a_exp: a_exp -> int
|
|
val eval_b_exp: b_exp -> bool
|
|
|
|
type 'a my_tree =
|
|
Leaf of 'a
|
|
| Node of ('a my_tree) list
|
|
|
|
val mod_list: 'a list -> 'a list list
|
|
|
|
(* --------------------------------------------------------------------------- *)
|
|
|
|
val to_tup : ('a -> 'b) -> ('c -> 'd) -> (('a * 'c) -> ('b * 'd))
|
|
|
|
val partialsum : int list -> int list
|
|
|
|
type label =
|
|
string
|
|
|
|
type 'a finite_state_automata = {
|
|
l: label;
|
|
next: ('a finite_state_automata * 'a list) list;
|
|
final: bool;
|
|
}
|
|
|
|
val check_included : 'a list -> 'a finite_state_automata -> bool
|
|
|
|
(* -------------------------------------------------------------------------- *)
|
|
|
|
module StringMap : Map.S with type key = string
|
|
|
|
type fsa = {
|
|
vertices: bool StringMap.t;
|
|
edges: (string * char) StringMap.t;
|
|
state: string;
|
|
}
|
|
|
|
val ex8 : char list -> fsa -> bool
|
|
|
|
|
|
type binary_tree =
|
|
Node of binary_tree * binary_tree
|
|
| Leaf of int
|
|
|
|
val ex9 : binary_tree -> int
|
|
|
|
(* -------------------------------------------------------------------------- *)
|