aboutsummaryrefslogblamecommitdiffstats
path: root/lib/dcl/sublanguage.ml
blob: c36e2a4248ecc55b1e2ac8a1af701ac8918a3150 (plain) (tree)
1
2
3
4
5
6
                                                                               
                                       

                          

                          















                                                              
                                                 
module Make (Storage : Management.Physical.S with type error = string) = struct
  module Exec = Executor.Make (Storage)

  type storage = Storage.t
  type ast = Ast.statement
  type error = Exec.error

  let name = "dcl"

  let parse_sexp sexp =
    match Parser.of_sexp sexp with
    | Ok r -> Ok r
    | Error (Parser.ParseError s) -> Error (Exec.ParseError s)

  let execute storage db ast =
    match Exec.execute storage db ast with
    | Ok (db, msg) -> Ok (Sublanguage.Transition (db, msg))
    | Error e -> Error e

  let sexp_of_error = Exec.sexp_of_error
end

module Memory = Make (Management.Physical.Memory)