aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dml/parser.ml
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/dml/parser.ml9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/dml/parser.ml b/lib/dml/parser.ml
new file mode 100644
index 0000000..a7981c0
--- /dev/null
+++ b/lib/dml/parser.ml
@@ -0,0 +1,9 @@
+type error = ParseError of string
+
+let of_string s =
+ match Sexplib.Sexp.of_string s |> Ast.statement_of_sexp with
+ | stmt -> Ok stmt
+ | exception exn -> Error (ParseError (Printexc.to_string exn))
+
+let to_string stmt =
+ Ast.sexp_of_statement stmt |> Sexplib.Sexp.to_string_hum