default.ml 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. (** Default implementation which does nothing.
  2. This module is expected to be used when you only need to implement an analyze
  3. over a limited part of the whole syntax. *)
  4. module type T = sig
  5. type t
  6. val default : t
  7. end
  8. module Expression (T' : T) = struct
  9. (**
  10. Describe a variable, using the name in capitalized text, and an optionnal
  11. index.
  12. If missing, the index should be considered as [0].
  13. *)
  14. type t' = T'.t
  15. let ident : (S.pos, T'.t) S.variable -> T'.t = fun _ -> T'.default
  16. (*
  17. Basic values, text, number…
  18. *)
  19. let integer : S.pos -> string -> T'.t = fun _ _ -> T'.default
  20. let literal : S.pos -> T'.t T.literal list -> T'.t = fun _ _ -> T'.default
  21. (** Call a function. The functions list is hardcoded in lib/lexer.mll *)
  22. let function_ : S.pos -> T.function_ -> T'.t list -> T'.t =
  23. fun _ _ _ -> T'.default
  24. (** Unary operator like [-123] or [+'Text']*)
  25. let uoperator : S.pos -> T.uoperator -> T'.t -> T'.t = fun _ _ _ -> T'.default
  26. (** Binary operator, for a comparaison, or an operation *)
  27. let boperator : S.pos -> T.boperator -> T'.t -> T'.t -> T'.t =
  28. fun _ _ _ _ -> T'.default
  29. end