diff options
author | Chimrod <> | 2025-07-19 11:18:24 +0200 |
---|---|---|
committer | Chimrod <> | 2025-08-01 14:12:14 +0200 |
commit | 3046fb0d0c1ceac2c6a6ca9456e9e05671e0cef9 (patch) | |
tree | 8ba2700e541a6753499ceac54ced4f1d02a3b625 /lib/syntax/identifier.ml | |
parent | 406b7b79cd375b071f92ddee9cee14a98dc91281 (diff) |
Diffstat (limited to 'lib/syntax/identifier.ml')
-rw-r--r-- | lib/syntax/identifier.ml | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/lib/syntax/identifier.ml b/lib/syntax/identifier.ml new file mode 100644 index 0000000..422171c --- /dev/null +++ b/lib/syntax/identifier.ml @@ -0,0 +1,55 @@ +type t = + | E : { + module_ : + (module Analyzer.T + with type Expression.t = 'a + and type Expression.t' = 'b + and type Instruction.t = 'c + and type Instruction.t' = 'd + and type Location.t = 'e + and type context = 'f + and type ex = t); + expr_witness : 'a Type.Id.t; + expr' : 'b Type.Id.t; + instr_witness : 'c Type.Id.t; + instr' : 'd Type.Id.t; + location_witness : 'e Type.Id.t; + context : 'f Type.Id.t; + } + -> t (** Type of check to apply *) + +let get_module : t -> (module Analyzer.T) = + fun (E { module_; _ }) -> (module_ :> (module Analyzer.T)) + +let build : + ?expression_id:'a Type.Id.t -> + ?location_id:'b Type.Id.t -> + ?context_id:'c Type.Id.t -> + (module Analyzer.T + with type Expression.t = 'a + and type Expression.t' = _ + and type Instruction.t = _ + and type Instruction.t' = _ + and type Location.t = 'b + and type context = 'c + and type ex = t) -> + t = + fun ?expression_id ?location_id ?context_id module_ -> + let expr_witness = + match expression_id with None -> Type.Id.make () | Some v -> v + and expr' = Type.Id.make () + and instr_witness = Type.Id.make () + and instr' = Type.Id.make () + and location_witness = + match location_id with Some v -> v | None -> Type.Id.make () + and context = match context_id with Some v -> v | None -> Type.Id.make () in + E + { + module_; + expr_witness; + expr'; + instr_witness; + instr'; + location_witness; + context; + } |