From 0b75cd5bc0f7d0ad905bce5bebc6e47c927f64d7 Mon Sep 17 00:00:00 2001 From: Chimrod <> Date: Mon, 16 Oct 2023 16:42:53 +0200 Subject: Used the dead-end checker in main analysis --- lib/syntax/default.ml | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'lib/syntax/default.ml') diff --git a/lib/syntax/default.ml b/lib/syntax/default.ml index eed7f2b..dad5144 100644 --- a/lib/syntax/default.ml +++ b/lib/syntax/default.ml @@ -3,7 +3,13 @@ This module is expected to be used when you only need to implement an analyze over a limited part of the whole syntax. *) -module Expression = struct +module type T = sig + type t + + val default : t +end + +module Expression (T' : T) = struct (** Describe a variable, using the name in capitalized text, and an optionnal index. @@ -11,28 +17,29 @@ module Expression = struct If missing, the index should be considered as [0]. *) - type t = unit - type t' = unit - - let ident : (S.pos, t S.repr) S.variable -> t S.repr = - fun _ report -> ((), report) + let ident : (S.pos, T'.t S.repr) S.variable -> T'.t S.repr = + fun _ report -> (T'.default, report) (* Basic values, text, number… *) - let integer : S.pos -> string -> t S.repr = fun _ _ report -> ((), report) - let literal : S.pos -> string -> t S.repr = fun _ _ report -> ((), report) + let integer : S.pos -> string -> T'.t S.repr = + fun _ _ report -> (T'.default, report) + + let literal : S.pos -> string -> T'.t S.repr = + fun _ _ report -> (T'.default, report) (** Call a function. The functions list is hardcoded in lib/lexer.mll *) - let function_ : S.pos -> T.function_ -> t S.repr list -> t S.repr = - fun _ _ _ report -> ((), report) + let function_ : S.pos -> T.function_ -> T'.t S.repr list -> T'.t S.repr = + fun _ _ _ report -> (T'.default, report) (** Unary operator like [-123] or [+'Text']*) - let uoperator : S.pos -> T.uoperator -> t S.repr -> t S.repr = - fun _ _ _ report -> ((), report) + let uoperator : S.pos -> T.uoperator -> T'.t S.repr -> T'.t S.repr = + fun _ _ _ report -> (T'.default, report) (** Binary operator, for a comparaison, or an operation *) - let boperator : S.pos -> T.boperator -> t S.repr -> t S.repr -> t S.repr = - fun _ _ _ _ report -> ((), report) + let boperator : + S.pos -> T.boperator -> T'.t S.repr -> T'.t S.repr -> T'.t S.repr = + fun _ _ _ _ report -> (T'.default, report) end -- cgit v1.2.3