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